@@ -478,7 +478,7 @@ export function useHeTree<T extends Record<string, any>>(
478
478
return r
479
479
}
480
480
}
481
- const onExternalDropToRoot : React . DragEventHandler < HTMLElement > = ( e ) => {
481
+ const onDropToRoot : React . DragEventHandler < HTMLElement > = ( e ) => {
482
482
if ( isExternal && ! props . onExternalDragOver ?.( e ) ) {
483
483
return
484
484
}
@@ -598,7 +598,7 @@ export function useHeTree<T extends Record<string, any>>(
598
598
}
599
599
return index
600
600
}
601
- return { visibleIds, attrsList, onDragOverRoot, onExternalDropToRoot , onDragEndOnRoot }
601
+ return { visibleIds, attrsList, onDragOverRoot, onDropToRoot , onDragEndOnRoot }
602
602
} , [ mainCache , indent , draggedStat ,
603
603
// watch placeholder position
604
604
placeholder ?. parentStat , placeholder ?. index ,
@@ -636,7 +636,7 @@ export function useHeTree<T extends Record<string, any>>(
636
636
} , [ props . keepPlaceholder ] )
637
637
useAddEventListener ( t2 . getEl , 'dragover' , t2 . onDragOverWindow )
638
638
//
639
- const { visibleIds, attrsList, onDragOverRoot, onExternalDropToRoot , onDragEndOnRoot } = cacheForVisible
639
+ const { visibleIds, attrsList, onDragOverRoot, onDropToRoot , onDragEndOnRoot } = cacheForVisible
640
640
const persistentIndices = useMemo ( ( ) => draggedStat ? [ visibleIds . indexOf ( draggedStat . id ) ] : [ ] , [ draggedStat , visibleIds ] ) ;
641
641
// render
642
642
const renderHeTree = ( options ?: { className ?: string , style ?: React . CSSProperties } ) => {
@@ -648,7 +648,7 @@ export function useHeTree<T extends Record<string, any>>(
648
648
</ div >
649
649
}
650
650
return (
651
- < div className = { `he-tree ${ options ?. className || '' } ` } style = { options ?. style } ref = { rootRef } onDragOver = { onDragOverRoot } onExternalDrop = { onExternalDropToRoot } onDragEnd = { onDragEndOnRoot } >
651
+ < div className = { `he-tree ${ options ?. className || '' } ` } style = { options ?. style } ref = { rootRef } onDragOver = { onDragOverRoot } onDrop = { onDropToRoot } onDragEnd = { onDragEndOnRoot } >
652
652
< VirtualList < Id > ref = { virtualListRef } items = { visibleIds } virtual = { props . virtual } persistentIndices = { persistentIndices } style = { { height : '100%' } }
653
653
renderItem = { ( id , index ) => renderNodeBox ( {
654
654
stat : getStat ( id ) ! , attrs : attrsList [ index ] , isPlaceholder : id === placeholderId
0 commit comments