Skip to content

Commit 41943f0

Browse files
committed
fix: rename onDropToRoot back
1 parent 731c116 commit 41943f0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/HeTree.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ export function useHeTree<T extends Record<string, any>>(
478478
return r
479479
}
480480
}
481-
const onExternalDropToRoot: React.DragEventHandler<HTMLElement> = (e) => {
481+
const onDropToRoot: React.DragEventHandler<HTMLElement> = (e) => {
482482
if (isExternal && !props.onExternalDragOver?.(e)) {
483483
return
484484
}
@@ -598,7 +598,7 @@ export function useHeTree<T extends Record<string, any>>(
598598
}
599599
return index
600600
}
601-
return { visibleIds, attrsList, onDragOverRoot, onExternalDropToRoot, onDragEndOnRoot }
601+
return { visibleIds, attrsList, onDragOverRoot, onDropToRoot, onDragEndOnRoot }
602602
}, [mainCache, indent, draggedStat,
603603
// watch placeholder position
604604
placeholder?.parentStat, placeholder?.index,
@@ -636,7 +636,7 @@ export function useHeTree<T extends Record<string, any>>(
636636
}, [props.keepPlaceholder])
637637
useAddEventListener(t2.getEl, 'dragover', t2.onDragOverWindow)
638638
//
639-
const { visibleIds, attrsList, onDragOverRoot, onExternalDropToRoot, onDragEndOnRoot } = cacheForVisible
639+
const { visibleIds, attrsList, onDragOverRoot, onDropToRoot, onDragEndOnRoot } = cacheForVisible
640640
const persistentIndices = useMemo(() => draggedStat ? [visibleIds.indexOf(draggedStat.id)] : [], [draggedStat, visibleIds]);
641641
// render
642642
const renderHeTree = (options?: { className?: string, style?: React.CSSProperties }) => {
@@ -648,7 +648,7 @@ export function useHeTree<T extends Record<string, any>>(
648648
</div>
649649
}
650650
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}>
652652
<VirtualList<Id> ref={virtualListRef} items={visibleIds} virtual={props.virtual} persistentIndices={persistentIndices} style={{ height: '100%' }}
653653
renderItem={(id, index) => renderNodeBox({
654654
stat: getStat(id)!, attrs: attrsList[index], isPlaceholder: id === placeholderId

0 commit comments

Comments
 (0)