summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah <kevinlukej@gmail.com>2024-08-26 19:09:30 +0200
committerLeah <kevinlukej@gmail.com>2024-08-26 19:09:30 +0200
commitecbe595b343416ddecbc8363baab6ac3e299f70b (patch)
treec0e982a6f2724d6f17edec9601c66585c03c76f2
parentmerge: thunk the min/max promises (!603) (diff)
downloadsharkey-ecbe595b343416ddecbc8363baab6ac3e299f70b.tar.gz
sharkey-ecbe595b343416ddecbc8363baab6ac3e299f70b.tar.bz2
sharkey-ecbe595b343416ddecbc8363baab6ac3e299f70b.zip
added event to detect when control and enter are pressed to confirm it. Also escape now escapes the window
-rw-r--r--packages/frontend/src/components/MkFileCaptionEditWindow.vue12
1 files changed, 11 insertions, 1 deletions
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
<template #header>{{ i18n.ts.describeFile }}</template>
<MkSpacer :marginMin="20" :marginMax="28">
<MkDriveFileThumbnail :file="file" fit="contain" style="height: 193px; margin-bottom: 16px;"/>
- <MkTextarea v-model="caption" autofocus :placeholder="i18n.ts.inputNewDescription">
+ <MkTextarea v-model="caption" autofocus :placeholder="i18n.ts.inputNewDescription" @keydown="onKeydown($event)">
<template #label>{{ i18n.ts.caption }}</template>
</MkTextarea>
</MkSpacer>
@@ -46,6 +46,16 @@ const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
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();