diff --git a/simple-mind-map/src/Render.js b/simple-mind-map/src/Render.js index 65693d70..feca4b26 100644 --- a/simple-mind-map/src/Render.js +++ b/simple-mind-map/src/Render.js @@ -552,29 +552,35 @@ class Render { if (this.activeNodeList.length <= 0) { return } - for (let i = 0; i < this.activeNodeList.length; i++) { - let node = this.activeNodeList[i] - if (node.isGeneralization) { - // 删除概要节点 - this.setNodeData(node.generalizationBelongNode, { - generalization: null - }) - node.generalizationBelongNode.update() - this.removeActiveNode(node) - i-- - } else if (node.isRoot) { - node.children.forEach(child => { - child.remove() - }) - node.children = [] - node.nodeData.children = [] - break - } else { - this.removeActiveNode(node) - this.removeOneNode(node) - i-- + let root = this.activeNodeList.find((node) => { + return node.isRoot + }) + if (root) { + this.clearActive() + root.children.forEach(child => { + child.remove() + }) + root.children = [] + root.nodeData.children = [] + } else { + for (let i = 0; i < this.activeNodeList.length; i++) { + let node = this.activeNodeList[i] + if (node.isGeneralization) { + // 删除概要节点 + this.setNodeData(node.generalizationBelongNode, { + generalization: null + }) + node.generalizationBelongNode.update() + this.removeActiveNode(node) + i-- + } else { + this.removeActiveNode(node) + this.removeOneNode(node) + i-- + } } } + this.activeNodeList = [] this.mindMap.emit('node_active', null, []) this.mindMap.render() } diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index 77b61b8d..b4654dd8 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -2,7 +2,9 @@ ## 0.3.4 -New:1.Automatic line wrapping function is added to node text. +New:Automatic line wrapping function is added to node text. + +Fix: Fix the problem of deletion exceptions if there are root nodes in the batch deleted nodes. ## 0.3.3 diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index 37d914a3..be8aabfc 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -2,7 +2,8 @@
New:1.Automatic line wrapping function is added to node text.
+New:Automatic line wrapping function is added to node text.
+Fix: Fix the problem of deletion exceptions if there are root nodes in the batch deleted nodes.
Fix: The root node text cannot wrap.
New:1.节点文本增加自动换行功能。
+New:节点文本增加自动换行功能。
+Fix:修复批量删除的节点中如果存在根节点会出现删除异常的问题。
修复:根节点文字无法换行的问题。