mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-28 10:28:33 -05:00
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
This commit is contained in:
@@ -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)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user