feat: implement global context-aware keyboard shortcuts and modal keyboard support (Enter/Esc)

This commit is contained in:
Tiberiu Ichim 2026-02-20 18:28:37 +02:00
parent 696961ea4c
commit 791d78884d
7 changed files with 36 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<template>
<modals-modal v-model="show" name="batchQuickMatch" :processing="processing" :width="500" :height="'unset'">
<modals-modal v-model="show" name="batchQuickMatch" :processing="processing" :width="500" :height="'unset'" @submit="doBatchQuickMatch">
<template #outer>
<div class="absolute top-0 left-0 p-5 w-2/3 overflow-hidden">
<p class="text-3xl text-white truncate">{{ title }}</p>

View file

@ -108,6 +108,13 @@ export default {
if (this.$store.state.innerModalOpen) return
if (action === this.$hotkeys.Modal.CLOSE) {
this.show = false
} else if (action === this.$hotkeys.Modal.SUBMIT) {
const activeElement = document.activeElement
// Don't submit if we are in a textarea or certain inputs
if (activeElement && ['TEXTAREA'].includes(activeElement.tagName)) {
return
}
this.$emit('submit')
}
},
setShow() {

View file

@ -1,5 +1,5 @@
<template>
<modals-modal ref="modal" v-model="show" name="move-to-library" :width="400" :height="'unset'" :processing="processing">
<modals-modal ref="modal" v-model="show" name="move-to-library" :width="400" :height="'unset'" :processing="processing" @submit="moveItems">
<template #outer>
<div class="absolute top-0 left-0 p-5 w-2/3 overflow-hidden">
<p class="text-3xl text-white truncate">{{ $strings.LabelMoveToLibrary }}</p>

View file

@ -1,5 +1,5 @@
<template>
<modals-modal ref="modal" v-model="show" name="split-book" :width="600" :height="'unset'" :processing="processing">
<modals-modal ref="modal" v-model="show" name="split-book" :width="600" :height="'unset'" :processing="processing" @submit="submit">
<template #outer>
<div class="absolute top-0 left-0 p-5 w-2/3 overflow-hidden">
<p class="text-3xl text-white truncate">{{ $strings.HeaderSplitBook || 'Split Book' }}</p>