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 @@ -思绪思维导图
\ No newline at end of file +思绪思维导图
\ No newline at end of file diff --git a/simple-mind-map/package.json b/simple-mind-map/package.json index 0ef87aee..bb56420b 100644 --- a/simple-mind-map/package.json +++ b/simple-mind-map/package.json @@ -1,6 +1,6 @@ { "name": "simple-mind-map", - "version": "0.6.9", + "version": "0.6.9-fix.1", "description": "一个简单的web在线思维导图", "authors": [ { diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index f09ad06d..a34737f9 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -1,5 +1,11 @@ # Changelog +## 0.6.9-fix.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. + ## 0.6.9 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. diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index 00fd1d31..7b75a64c 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -1,6 +1,9 @@