From def2f02eeaa70344d3ff0f7b613f70463ba45f64 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Fri, 28 Jul 2023 16:36:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=80=E6=AC=A1=E5=8D=95=E4=B8=AA=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E5=90=8E=E5=86=8D=E5=85=A8=E9=83=A8=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= =?UTF-8?q?2.=E4=B8=8D=E4=BC=9A=E5=86=8D=E7=9B=B4=E6=8E=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BC=A0=E5=85=A5=E7=9A=84data=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=EF=BC=8C=E5=86=85=E9=83=A8=E4=BC=9A=E6=B7=B1=E6=8B=B7=E8=B4=9D?= =?UTF-8?q?=E4=B8=80=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/Render.js | 2 +- simple-mind-map/src/plugins/Search.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/simple-mind-map/src/core/render/Render.js b/simple-mind-map/src/core/render/Render.js index 217751de..0ae17ed6 100644 --- a/simple-mind-map/src/core/render/Render.js +++ b/simple-mind-map/src/core/render/Render.js @@ -48,7 +48,7 @@ class Render { this.themeConfig = this.mindMap.themeConfig this.draw = this.mindMap.draw // 渲染树,操作过程中修改的都是这里的数据 - this.renderTree = merge({}, this.mindMap.opt.data || {}) + this.renderTree = merge({}, simpleDeepClone(this.mindMap.opt.data) || {}) // 是否重新渲染 this.reRender = false // 是否正在渲染中 diff --git a/simple-mind-map/src/plugins/Search.js b/simple-mind-map/src/plugins/Search.js index 5bbd3e77..7202ef5c 100644 --- a/simple-mind-map/src/plugins/Search.js +++ b/simple-mind-map/src/plugins/Search.js @@ -13,15 +13,18 @@ class Search { this.matchNodeList = [] // 当前所在的节点列表索引 this.currentIndex = -1 - // 是否正在跳转中 - this.isJumping = false + // 不要复位搜索文本 + this.notResetSearchText = false this.onDataChange = this.onDataChange.bind(this) this.mindMap.on('data_change', this.onDataChange) } // 节点数据改变了,需要重新搜索 onDataChange() { - if (this.isJumping) return + if (this.notResetSearchText) { + this.notResetSearchText = false + return + } this.searchText = '' } @@ -48,7 +51,7 @@ class Search { this.searchText = '' this.matchNodeList = [] this.currentIndex = -1 - this.isJumping = false + this.notResetSearchText = false this.isSearching = false this.emitEvent() } @@ -77,9 +80,8 @@ class Search { this.currentIndex = 0 } let currentNode = this.matchNodeList[this.currentIndex] - this.isJumping = true + this.notResetSearchText = true this.mindMap.execCommand('GO_TARGET_NODE', currentNode, () => { - this.isJumping = false callback() }) } @@ -92,10 +94,16 @@ class Search { let currentNode = this.matchNodeList[this.currentIndex] if (!currentNode) return let text = this.getReplacedText(currentNode, this.searchText, replaceText) + this.notResetSearchText = true currentNode.setText(text, currentNode.nodeData.data.richText) this.matchNodeList = this.matchNodeList.filter(node => { return currentNode !== node }) + if (this.currentIndex > this.matchNodeList.length - 1) { + this.currentIndex = -1 + } else { + this.currentIndex-- + } this.emitEvent() } From 5d0c9dcab1c4a6b8d3e6ba006fa507d1b99f7bb5 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Fri, 28 Jul 2023 16:46:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=89=93=E5=8C=850.6.9-fix.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- simple-mind-map/package.json | 2 +- web/src/pages/Doc/en/changelog/index.md | 6 ++++++ web/src/pages/Doc/en/changelog/index.vue | 3 +++ web/src/pages/Doc/zh/changelog/index.md | 6 ++++++ web/src/pages/Doc/zh/changelog/index.vue | 3 +++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 553768bd..a8ed770a 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -
Fix: 1.Fix the issue of incorrect replacement after a single search.
+New: 1.We will no longer directly modify the incoming data object, but will make a deep copy internally.
Fix: 1.Fixed an issue where setting styles to summary nodes would cause summary nodes to disappear. 2.Fixed the issue of node content not rendering when creating a root instance again when customizing node content. 3.Fix the issue of losing focus when adding a new node while the node is in editing. 2.Fix the issue of continuously pressing the tab key not being able to continuously create child nodes.
New: 1.Replace existing in SVG when exporting Characters to avoid exporting SVG errors. 2.Support for search and replace.
修复:1.修复搜索进行一次单个替换后再全部替换不正确的问题。
+新增:1.不会再直接修改传入的data对象,内部会深拷贝一份。
修复:1.修复给概要节点设置样式概要节点会消失的问题。2.修复自定义节点内容时,二次创建根实例时节点内容不渲染的问题。3.修复节点处于编辑中时添加新节点时新节点的焦点丢失问题。 2.修复连续按tab键无法连续创建子节点的问题。
新增:1.导出svg时替换svg中存在的 字符,避免导出的svg报错。 2.支持搜索和替换。