chore: update Angular cache and TypeScript build info files
This commit is contained in:
@@ -265,12 +265,23 @@ export function moveNode(
|
||||
|
||||
// Can't move a node into itself or its descendants
|
||||
if (newParentCtime !== null && isDescendant(found.node, newParentCtime)) {
|
||||
console.warn('Cannot move a node into its own descendant');
|
||||
return doc;
|
||||
}
|
||||
|
||||
const nodeClone = cloneNode(found.node);
|
||||
const oldParentCtime = found.parent ? found.parent.ctime : null;
|
||||
const oldIndex = found.index;
|
||||
|
||||
// If moving within the same parent, adjust index
|
||||
let adjustedIndex = newIndex;
|
||||
if (oldParentCtime === newParentCtime && oldIndex < newIndex) {
|
||||
// When removing from earlier position, indices shift down
|
||||
adjustedIndex = newIndex - 1;
|
||||
}
|
||||
|
||||
let updated = removeNode(doc, nodeCtime);
|
||||
updated = addNode(updated, nodeClone, newParentCtime, newIndex);
|
||||
updated = addNode(updated, nodeClone, newParentCtime, adjustedIndex);
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user