feat(core): dnd support external types (#9033)

fix AF-1847

two issues:
1. original `dropTargetForExternal` only works if dragging target is from another window context. patched the library to bypass this issue
2. `dataTransfer`'s content is only available on `drop` event. This means we cannot have `canDrop` checks for external elements (like blocksuite links).
This commit is contained in:
pengx17
2024-12-06 13:45:29 +00:00
committed by Peng Xiao
parent 6b14e1cf10
commit fafacdb265
17 changed files with 285 additions and 44 deletions
@@ -103,6 +103,8 @@ export const useDraggable = <D extends DNDData = DNDData>(
},
};
dragRef.current.dataset.affineDraggable = 'true';
const cleanupDraggable = draggable({
element: dragRef.current,
dragHandle: dragHandleRef.current ?? undefined,