From 9db04467d93b48e5638e48d4655a6a634f41389b Mon Sep 17 00:00:00 2001 From: Ayaka Rizumu <464388324@qq.com> Date: Wed, 14 Dec 2022 02:29:42 +0800 Subject: [PATCH] fix(command): alternative to cmd+/ (#414) --- components/modal/ModalContainer.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/modal/ModalContainer.vue b/components/modal/ModalContainer.vue index 56e3dfb2..ff6a2fea 100644 --- a/components/modal/ModalContainer.vue +++ b/components/modal/ModalContainer.vue @@ -11,8 +11,16 @@ import { const isMac = useIsMac() // TODO: temporary, await for keybind system +// open search panel +// listen to ctrl+k on windows/linux or cmd+k on mac +// open command panel // listen to ctrl+/ on windows/linux or cmd+/ on mac +// or shift+ctrl+k on windows/linux or shift+cmd+k on mac useEventListener('keydown', (e: KeyboardEvent) => { + if (e.key === 'k' && (isMac.value ? e.metaKey : e.ctrlKey)) { + e.preventDefault() + openCommandPanel(e.shiftKey) + } if (e.key === '/' && (isMac.value ? e.metaKey : e.ctrlKey)) { e.preventDefault() openCommandPanel(true)