fix(command): alternative to cmd+/ (#414)

zio/stable
Ayaka Rizumu 2022-12-14 02:29:42 +08:00 committed by GitHub
parent f99bbeb362
commit 9db04467d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -11,8 +11,16 @@ import {
const isMac = useIsMac() const isMac = useIsMac()
// TODO: temporary, await for keybind system // 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 // 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) => { 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)) { if (e.key === '/' && (isMac.value ? e.metaKey : e.ctrlKey)) {
e.preventDefault() e.preventDefault()
openCommandPanel(true) openCommandPanel(true)