Browse Source

refactor(nc-gui): use e.key instead

pull/5342/head
Wing-Kam Wong 2 years ago
parent
commit
033d27457e
  1. 4
      packages/nc-gui/app.vue

4
packages/nc-gui/app.vue

@ -10,8 +10,8 @@ useTheme()
useEventListener(document, 'keydown', async (e: KeyboardEvent) => { useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
if (cmdOrCtrl) { if (cmdOrCtrl) {
switch (e.code) { switch (e.key.toLowerCase()) {
case 'KeyA': case 'a':
// prevent Ctrl + A selection for non-editable nodes // prevent Ctrl + A selection for non-editable nodes
if (!['input', 'textarea'].includes((e.target as any).nodeName.toLowerCase())) { if (!['input', 'textarea'].includes((e.target as any).nodeName.toLowerCase())) {
e.preventDefault() e.preventDefault()

Loading…
Cancel
Save