From dc2aaf2f7398b447c1d67a34564f5936863bb721 Mon Sep 17 00:00:00 2001 From: ridemountainpig Date: Mon, 8 Jan 2024 09:26:43 +0800 Subject: [PATCH] feat: add input hotkey script --- src/components/search.svelte | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/search.svelte b/src/components/search.svelte index f3d3092..9418e7d 100644 --- a/src/components/search.svelte +++ b/src/components/search.svelte @@ -5,12 +5,14 @@ export let clearSearch: () => void; import X from 'phosphor-svelte/lib/X'; - let shortcutText = 'control'; + let shortcutText: string = ''; let inputElement; if (typeof window !== 'undefined') { if (navigator.platform.toUpperCase().indexOf('MAC') !== -1) { shortcutText = 'command'; + } else { + shortcutText = 'control'; } } @@ -64,10 +66,11 @@
{#if shortcutText === 'command'} - {:else} + K + {:else if shortcutText === 'control'} Ctrl + K {/if} - K
{/if}