diff --git a/apps/www/.vitepress/theme/layout/MainLayout.vue b/apps/www/.vitepress/theme/layout/MainLayout.vue index 9a0b7a0c..23bc4121 100644 --- a/apps/www/.vitepress/theme/layout/MainLayout.vue +++ b/apps/www/.vitepress/theme/layout/MainLayout.vue @@ -49,7 +49,13 @@ const links = [ ] const isOpen = ref(false) -const { Meta_K, Ctrl_K } = useMagicKeys() +const { Meta_K, Ctrl_K } = useMagicKeys({ + passive: false, + onEventFired(e) { + if (e.key === 'k' && (e.metaKey || e.ctrlKey)) + e.preventDefault() + }, +}) watch([Meta_K, Ctrl_K], (v) => { if (v[0] || v[1]) diff --git a/apps/www/src/lib/registry/default/example/CommandDialogDemo.vue b/apps/www/src/lib/registry/default/example/CommandDialogDemo.vue index 9f18c79a..ddc3f24c 100644 --- a/apps/www/src/lib/registry/default/example/CommandDialogDemo.vue +++ b/apps/www/src/lib/registry/default/example/CommandDialogDemo.vue @@ -14,17 +14,22 @@ import { const open = ref(false) -const keys = useMagicKeys() -const CmdJ = keys['Cmd+J'] +const { Meta_J, Ctrl_J } = useMagicKeys({ + passive: false, + onEventFired(e) { + if (e.key === 'j' && (e.metaKey || e.ctrlKey)) + e.preventDefault() + }, +}) + +watch([Meta_J, Ctrl_J], (v) => { + if (v[0] || v[1]) + handleOpenChange() +}) function handleOpenChange() { open.value = !open.value } - -watch(CmdJ, (v) => { - if (v) - handleOpenChange() -})