Skip to content

Commit

Permalink
BUGFIX: Insert nodes in order of selection on „insertAfter“
Browse files Browse the repository at this point in the history
Resolves: #3040
  • Loading branch information
Sebobo committed Apr 10, 2024
1 parent 42ff732 commit 29d18d5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/neos-ui-sagas/src/CR/NodeOperations/pasteNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,25 @@ export default function * pasteNode({globalRegistry}) {
const referenceNodeSelector = selectors.CR.Nodes.makeGetNodeByContextPathSelector(reference);
const referenceNode = yield select(referenceNodeSelector);
const baseNodeType = yield select($get('ui.pageTree.filterNodeType'));
const changeType = calculateChangeTypeFromMode(mode, clipboardMode);
const domAddresses = calculateDomAddressesFromMode(mode, referenceNode, fusionPath);

yield put(actions.CR.Nodes.commitPaste(clipboardMode));
const changes = subject.map(contextPath => ({
type: calculateChangeTypeFromMode(mode, clipboardMode),
let changes = subject.map(contextPath => ({
type: changeType,
subject: contextPath,
payload: {
...calculateDomAddressesFromMode(mode, referenceNode, fusionPath),
...domAddresses,
baseNodeType
}
}));

// Reverse the order of nodes if we are pasting after the reference node as the insertions are all
// applied to the same reference node and would otherwise be applied in reverse order.
if (mode === 'after') {
changes = changes.reverse();
}

yield put(actions.Changes.persistChanges(changes));
}
});
Expand Down

0 comments on commit 29d18d5

Please sign in to comment.