fix: file not linking to note when uploaded by dragging on note
This commit is contained in:
@@ -166,6 +166,12 @@ const FileDragNDropProvider = ({ application, children, featuresController, file
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
let closestDragTarget: Element | null = null
|
||||
|
||||
if (event.target instanceof HTMLElement) {
|
||||
closestDragTarget = event.target.closest('[data-file-drag-target]')
|
||||
}
|
||||
|
||||
resetState()
|
||||
|
||||
if (!featuresController.hasFiles) {
|
||||
@@ -189,12 +195,6 @@ const FileDragNDropProvider = ({ application, children, featuresController, file
|
||||
return
|
||||
}
|
||||
|
||||
let closestDragTarget: Element | null = null
|
||||
|
||||
if (event.target instanceof HTMLElement) {
|
||||
closestDragTarget = event.target.closest('[data-file-drag-target]')
|
||||
}
|
||||
|
||||
if (closestDragTarget && dragTargets.current.has(closestDragTarget)) {
|
||||
dragTargets.current.get(closestDragTarget)?.callback(uploadedFiles)
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ const NoteViewFileDropTarget = ({ note, linkingController, noteViewElement }: Pr
|
||||
if (target) {
|
||||
addDragTarget(target, {
|
||||
tooltipText: 'Drop your files to upload and link them to the current note',
|
||||
callback(files) {
|
||||
callback: (files) => {
|
||||
files.forEach(async (uploadedFile) => {
|
||||
await linkingController.linkItems(uploadedFile, note)
|
||||
await linkingController.linkItems(note, uploadedFile)
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user