|
|
@ -132,10 +132,12 @@ const hide = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onClickOutside(modalEl, () => { |
|
|
|
onClickOutside(modalEl, () => { |
|
|
|
|
|
|
|
search.value = '' |
|
|
|
if (vOpen.value) hide() |
|
|
|
if (vOpen.value) hide() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const onKeyDown = (e: KeyboardEvent) => { |
|
|
|
useEventListener('keydown', (e: KeyboardEvent) => { |
|
|
|
|
|
|
|
console.log(e.key) |
|
|
|
if (e.key === 'Escape') { |
|
|
|
if (e.key === 'Escape') { |
|
|
|
hide() |
|
|
|
hide() |
|
|
|
} else if (e.key === 'Enter') { |
|
|
|
} else if (e.key === 'Enter') { |
|
|
@ -152,14 +154,16 @@ const onKeyDown = (e: KeyboardEvent) => { |
|
|
|
moveDown() |
|
|
|
moveDown() |
|
|
|
} else if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.key === 'l') { |
|
|
|
} else if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.key === 'l') { |
|
|
|
if (!user.value) return |
|
|
|
if (!user.value) return |
|
|
|
e.preventDefault() |
|
|
|
if (!vOpen.value) { |
|
|
|
if (!vOpen.value) vOpen.value = true |
|
|
|
vOpen.value = true |
|
|
|
|
|
|
|
} else { |
|
|
|
moveUp() |
|
|
|
moveUp() |
|
|
|
|
|
|
|
} |
|
|
|
} else if ((e.metaKey || e.ctrlKey) && e.key === 'l') { |
|
|
|
} else if ((e.metaKey || e.ctrlKey) && e.key === 'l') { |
|
|
|
if (!user.value) return |
|
|
|
if (!user.value) return |
|
|
|
e.preventDefault() |
|
|
|
if (!vOpen.value) { |
|
|
|
if (!vOpen.value) vOpen.value = true |
|
|
|
vOpen.value = true |
|
|
|
moveDown() |
|
|
|
} else moveDown() |
|
|
|
} else if ((e.ctrlKey || e.metaKey) && e.key === 'k') { |
|
|
|
} else if ((e.ctrlKey || e.metaKey) && e.key === 'k') { |
|
|
|
hide() |
|
|
|
hide() |
|
|
|
} else if ((e.ctrlKey || e.metaKey) && e.key === 'j') { |
|
|
|
} else if ((e.ctrlKey || e.metaKey) && e.key === 'j') { |
|
|
@ -167,7 +171,7 @@ const onKeyDown = (e: KeyboardEvent) => { |
|
|
|
} else if (vOpen.value) { |
|
|
|
} else if (vOpen.value) { |
|
|
|
cmdInputEl.value?.focus() |
|
|
|
cmdInputEl.value?.focus() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
document.querySelector('.cmdOpt-list')?.focus() |
|
|
|
document.querySelector('.cmdOpt-list')?.focus() |
|
|
@ -180,8 +184,6 @@ onMounted(() => { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selected.value = filteredViews.value[index + 1].tableID + filteredViews.value[index + 1].viewName |
|
|
|
selected.value = filteredViews.value[index + 1].tableID + filteredViews.value[index + 1].viewName |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('keydown', onKeyDown) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|