Skip to content

Commit 7ec948a

Browse files
committed
Restore treeIndex inputs to canDrop callback
1 parent 88a3124 commit 7ec948a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils/drag-and-drop-utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const externalSource = {
4242
},
4343
path: [],
4444
type: 'rst__NewItem',
45+
parentNode: null,
46+
treeIndex: -1, // Use -1 to indicate external node
4547
};
4648
},
4749

@@ -143,8 +145,10 @@ function canDrop(dropTargetProps, monitor, component) {
143145
node,
144146
prevPath: monitor.getItem().path,
145147
prevParent: monitor.getItem().parentNode,
148+
prevTreeIndex: monitor.getItem().treeIndex, // Equals -1 when dragged from external tree
146149
nextPath: addedResult.path,
147150
nextParent: addedResult.parentNode,
151+
nextTreeIndex: addedResult.treeIndex,
148152
});
149153
}
150154

0 commit comments

Comments
 (0)