From 1731b03c221e41ea2cce2ad6df70a7a8e81fb2a8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 24 Jan 2026 18:41:42 +0100 Subject: [PATCH] fix(editor): prevent file upload overlay when dragging text from editor (#2148) Fixes the file upload overlay incorrectly appearing when dragging text from within the TipTap description editor to outside of it. Fixes #1663 --- .../components/tasks/partials/Attachments.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/tasks/partials/Attachments.vue b/frontend/src/components/tasks/partials/Attachments.vue index 0b25fe0de..d50b7f0ee 100644 --- a/frontend/src/components/tasks/partials/Attachments.vue +++ b/frontend/src/components/tasks/partials/Attachments.vue @@ -245,12 +245,29 @@ function resetDragState() { isDragOverEditor.value = false } +/** + * Check if a drag event contains actual files (not text being dragged). + * This prevents the file upload overlay from appearing when dragging text + * from within the editor to outside it. + */ +function eventContainsFiles(event: Event | null | undefined): boolean { + if (!event || !(event instanceof DragEvent)) { + return false + } + return event.dataTransfer?.types.includes('Files') ?? false +} + const {isOverDropZone} = useDropZone(document, { onEnter(files, event) { if (!props.editEnabled) { return } - + + // Only show dropzone if actual files are being dragged, not text + if (!eventContainsFiles(event)) { + return + } + isDraggingFiles.value = true isDragOverEditor.value = eventTargetsEditor(event) },