|
@@ -561,7 +561,10 @@ export class Tree {
|
|
|
if (next) {
|
|
if (next) {
|
|
|
prev = next.getCtx().prev();
|
|
prev = next.getCtx().prev();
|
|
|
} else {
|
|
} else {
|
|
|
- prev = parent ? parent.getCtx().lastChild() : null;
|
|
|
|
|
|
|
+ const roots = this.getRoots();
|
|
|
|
|
+ prev = parent
|
|
|
|
|
+ ? parent.getCtx().lastChild()
|
|
|
|
|
+ : roots[roots.length - 1] || null;
|
|
|
}
|
|
}
|
|
|
const baseSeq = prev ? prev.seq + 1 : this.seqStartIndex;
|
|
const baseSeq = prev ? prev.seq + 1 : this.seqStartIndex;
|
|
|
updateData.push(
|
|
updateData.push(
|
|
@@ -574,7 +577,12 @@ export class Tree {
|
|
|
}))
|
|
}))
|
|
|
);
|
|
);
|
|
|
const curBaseSeq = baseSeq + nodes.length;
|
|
const curBaseSeq = baseSeq + nodes.length;
|
|
|
- const nextBrothers = prev ? prev.getCtx().nextBrothers() : [];
|
|
|
|
|
|
|
+ // eslint-disable-next-line no-nested-ternary
|
|
|
|
|
+ const nextBrothers = prev
|
|
|
|
|
+ ? prev.getCtx().nextBrothers()
|
|
|
|
|
+ : next
|
|
|
|
|
+ ? [next, ...next.getCtx().nextBrothers()]
|
|
|
|
|
+ : [];
|
|
|
updateData.push(
|
|
updateData.push(
|
|
|
...nextBrothers.map((node, index) => ({
|
|
...nextBrothers.map((node, index) => ({
|
|
|
ID: node.ID,
|
|
ID: node.ID,
|