From ecbe595b343416ddecbc8363baab6ac3e299f70b Mon Sep 17 00:00:00 2001 From: Leah Date: Mon, 26 Aug 2024 19:09:30 +0200 Subject: [PATCH] added event to detect when control and enter are pressed to confirm it. Also escape now escapes the window --- .../src/components/MkFileCaptionEditWindow.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkFileCaptionEditWindow.vue b/packages/frontend/src/components/MkFileCaptionEditWindow.vue index 39551e6b3c..8ff6308fb1 100644 --- a/packages/frontend/src/components/MkFileCaptionEditWindow.vue +++ b/packages/frontend/src/components/MkFileCaptionEditWindow.vue @@ -17,7 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + @@ -46,6 +46,16 @@ const dialog = shallowRef>(); const caption = ref(props.default); +function onKeydown(ev: KeyboardEvent) { + if (ev.key === 'Enter' && (ev.ctrlKey || ev.metaKey)) ok(); + + if (ev.key === 'Escape') { + emit('closed'); + dialog.value?.close(); + } +} + + async function ok() { emit('done', caption.value); dialog.value?.close();