refactor: use react-arborist built-in drag for internal node moves

Switch from native HTML5 drag to react-arborist's built-in drag system
for internal node drag-and-drop. The HTML5Backend used by react-arborist
was intercepting dragstart events, preventing native drag from working.

- Add onMove callback and disableDrop validation to Tree component
- Sync react-arborist drag state (isDragging, willReceiveDrop) to Zustand
- Simplify use-node-move to only handle API execution
- Update use-unified-drag to only handle external file uploads
- External file drops continue to work via native HTML5 events
This commit is contained in:
yyh
2026-01-20 17:52:18 +08:00
parent dc9658b003
commit 2151676db1
6 changed files with 121 additions and 135 deletions

View File

@ -19,8 +19,8 @@ type UseRootFileDropOptions = {
treeChildren: AppAssetTreeView[]
}
export function useRootFileDrop({ treeChildren }: UseRootFileDropOptions): UseRootFileDropReturn {
const { handleDragOver, handleDragLeave, handleDrop } = useUnifiedDrag({ treeChildren })
export function useRootFileDrop({ treeChildren: _treeChildren }: UseRootFileDropOptions): UseRootFileDropReturn {
const { handleDragOver, handleDragLeave, handleDrop } = useUnifiedDrag()
const dragCounterRef = useRef(0)
const handleRootDragEnter = useCallback((e: React.DragEvent) => {