From eab1a211ae320d55db531b0f5e5b94d25bf0cf94 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 22 Nov 2025 16:22:36 +0100 Subject: [PATCH] fix(components): fix clipboard data null checks in TipTap.vue - Add proper null check for clipboardData.items before accessing length - Replace for...of loop with indexed for loop to avoid iterator issue with DataTransferItemList --- frontend/src/components/input/editor/TipTap.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/input/editor/TipTap.vue b/frontend/src/components/input/editor/TipTap.vue index d562646a2..ff7d0ca71 100644 --- a/frontend/src/components/input/editor/TipTap.vue +++ b/frontend/src/components/input/editor/TipTap.vue @@ -355,11 +355,12 @@ const PasteHandler = Extension.create({ key: new PluginKey('pasteHandler'), props: { handlePaste: (view, event) => { - - // Handle images pasted from clipboard - if (typeof props.uploadCallback !== 'undefined' && event.clipboardData?.items?.length > 0) { - for (const item of event.clipboardData.items) { + // Handle images pasted from clipboard + if (typeof props.uploadCallback !== 'undefined' && event.clipboardData?.items && event.clipboardData.items.length > 0) { + + for (let i = 0; i < event.clipboardData.items.length; i++) { + const item = event.clipboardData.items[i] if (item.kind === 'file' && item.type.startsWith('image/')) { const file = item.getAsFile() if (file) {