From c7ddd0b44a2ec92c54f1af992bb894f72907cab6 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Tue, 3 Sep 2024 23:53:34 -0400 Subject: [PATCH] fix(web): paste event in input fields (#12297) --- web/src/lib/actions/shortcut.ts | 4 ++-- .../drag-and-drop-upload-overlay.svelte | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/web/src/lib/actions/shortcut.ts b/web/src/lib/actions/shortcut.ts index d28c294a89..df155ea821 100644 --- a/web/src/lib/actions/shortcut.ts +++ b/web/src/lib/actions/shortcut.ts @@ -15,7 +15,7 @@ export type ShortcutOptions = { preventDefault?: boolean; }; -export const shouldIgnoreShortcut = (event: KeyboardEvent): boolean => { +export const shouldIgnoreEvent = (event: KeyboardEvent | ClipboardEvent): boolean => { if (event.target === event.currentTarget) { return false; } @@ -52,7 +52,7 @@ export const shortcuts = ( options: ShortcutOptions[], ): ActionReturn[]> => { function onKeydown(event: KeyboardEvent) { - const ignoreShortcut = shouldIgnoreShortcut(event); + const ignoreShortcut = shouldIgnoreEvent(event); for (const { shortcut, onShortcut, ignoreInputFields = true, preventDefault = true } of options) { if (ignoreInputFields && ignoreShortcut) { continue; diff --git a/web/src/lib/components/shared-components/drag-and-drop-upload-overlay.svelte b/web/src/lib/components/shared-components/drag-and-drop-upload-overlay.svelte index e84d2d66f0..6f92d81886 100644 --- a/web/src/lib/components/shared-components/drag-and-drop-upload-overlay.svelte +++ b/web/src/lib/components/shared-components/drag-and-drop-upload-overlay.svelte @@ -1,11 +1,12 @@