Skip to content

Commit

Permalink
BUGFIX: Insert tree items in selected order on drag & drop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Apr 10, 2024
1 parent 157521c commit ceeccbc
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,14 @@ export default class NodeTree extends PureComponent {
}

handleDrop = (targetNode, position) => {
const {currentlyDraggedNodes} = this.state;
let {currentlyDraggedNodes} = this.state;
const {moveNodes, focus} = this.props;

if (position === 'after') {
// Reverse the order of nodes to keep the correct order after each node is inserted after the target node individually
currentlyDraggedNodes = Array.from(currentlyDraggedNodes).reverse();
}

moveNodes(currentlyDraggedNodes, $get('contextPath', targetNode), position);
// We need to refocus the tree, so all focus would be reset, because its context paths have changed while moving
// Could be removed with the new CR
Expand Down

0 comments on commit ceeccbc

Please sign in to comment.