From 34ef1e908e1483e5273f3f59f67e8e783ca847f3 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Sat, 24 Sep 2022 20:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=8A=82=E7=82=B9=E6=97=B6=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E8=81=9A=E7=84=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/Node.js | 8 +++++++- simple-mind-map/src/Render.js | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) 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