diff --git a/simple-mind-map/src/Node.js b/simple-mind-map/src/Node.js index 2f5b615b..08e06f71 100644 --- a/simple-mind-map/src/Node.js +++ b/simple-mind-map/src/Node.js @@ -694,7 +694,7 @@ class Node { if (this.mindMap.opt.readonly) { return } - e.stopPropagation() + e && e.stopPropagation() if (this.nodeData.data.isActive) { return } @@ -769,6 +769,12 @@ class Node { } })) } + // 手动插入的节点立即获得焦点并且开启编辑模式 + if (this.nodeData.inserting) { + delete this.nodeData.inserting + this.active() + this.mindMap.emit('node_dblclick', this) + } } /** diff --git a/simple-mind-map/src/Render.js b/simple-mind-map/src/Render.js index 14f710eb..445811fa 100644 --- a/simple-mind-map/src/Render.js +++ b/simple-mind-map/src/Render.js @@ -413,6 +413,7 @@ class Render { } let index = this.getNodeIndex(first) first.parent.nodeData.children.splice(index + 1, 0, { + "inserting": true, "data": { "text": text, "expand": true @@ -438,6 +439,7 @@ class Render { } let text = node.isRoot ? '二级节点' : '分支主题' node.nodeData.children.push({ + "inserting": true, "data": { "text": text, "expand": true