feat(Kbd): special keys for macOS and other systems (#2494)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Alexander
2024-10-31 19:14:15 +05:00
committed by GitHub
parent f26f6c8168
commit 332c6c08d7
9 changed files with 283 additions and 268 deletions

View File

@@ -3,7 +3,6 @@
import { ref, computed, toValue } from 'vue'
import type { MaybeRef } from 'vue'
import { useEventListener, useActiveElement, useDebounceFn } from '@vueuse/core'
import { useKbd } from '../composables/useKbd'
type Handler = (e?: any) => void
@@ -67,7 +66,6 @@ export function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options: Shor
}
const debouncedClearChainedInput = useDebounceFn(clearChainedInput, options.chainDelay ?? 800)
const { macOS } = useKbd()
const activeElement = useActiveElement()
const onKeyDown = (e: KeyboardEvent) => {
@@ -180,12 +178,6 @@ export function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options: Shor
}
shortcut.chained = chained
// Convert Meta to Ctrl for non-MacOS
if (!macOS.value && shortcut.metaKey && !shortcut.ctrlKey) {
shortcut.metaKey = false
shortcut.ctrlKey = true
}
// Retrieve handler function
if (typeof shortcutConfig === 'function') {
shortcut.handler = shortcutConfig