From 423405233185aa2708014813dda0a553e6fc036d Mon Sep 17 00:00:00 2001 From: Zhigang Zhang Date: Fri, 15 Dec 2023 23:30:42 +0800 Subject: [PATCH] update index after remove node (#554) --- src/jsmind.mind.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jsmind.mind.js b/src/jsmind.mind.js index 9b6d0059..02f4a6e2 100644 --- a/src/jsmind.mind.js +++ b/src/jsmind.mind.js @@ -219,8 +219,9 @@ export class Mind { } // clean all children children.length = 0; + var node_parent = node.parent; // remove from parent's children - var sibling = node.parent.children; + var sibling = node_parent.children; var si = sibling.length; while (si--) { if (sibling[si].id == node.id) { @@ -236,7 +237,7 @@ export class Mind { } // remove it's self node = null; - //delete node; + this._update_index(node_parent); return true; } _put_node(node) {