From e2403ae43314a4f82fe2452403766e405d9161a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Mon, 8 Apr 2024 18:07:37 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=AF=8C?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=8F=92=E4=BB=B6=E8=BD=AC=E6=8D=A2=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=95=B0=E6=8D=AE=E6=97=B6=E6=B2=A1=E6=9C=89=E5=A4=84?= =?UTF-8?q?=E7=90=86=E8=8A=82=E7=82=B9=E6=A6=82=E8=A6=81=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/RichText.js | 29 ++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/simple-mind-map/src/plugins/RichText.js b/simple-mind-map/src/plugins/RichText.js index 9fdd8e6f..3e84f7c3 100644 --- a/simple-mind-map/src/plugins/RichText.js +++ b/simple-mind-map/src/plugins/RichText.js @@ -327,8 +327,8 @@ class RichText { list.forEach(node => { this.mindMap.execCommand('SET_NODE_TEXT', node, html, true) // if (node.isGeneralization) { - // 概要节点 - // node.generalizationBelongNode.updateGeneralization() + // 概要节点 + // node.generalizationBelongNode.updateGeneralization() // } this.mindMap.render() }) @@ -649,7 +649,18 @@ class RichText { if (node.data.richText) { node.data.richText = false node.data.text = getTextFromHtml(node.data.text) - // delete node.data.uid + } + // 概要 + let generalization = + node.data && node.data.generalization ? node.data.generalization : [] + generalization = Array.isArray(generalization) + ? generalization + : [generalization] + if (generalization.length > 0) { + generalization.forEach(item => { + item.richText = false + item.text = getTextFromHtml(item.text) + }) } }, null, @@ -670,6 +681,18 @@ class RichText { root.data.richText = true root.data.resetRichText = true } + // 概要 + let generalization = + root.data && root.data.generalization ? root.data.generalization : [] + generalization = Array.isArray(generalization) + ? generalization + : [generalization] + if (generalization.length > 0) { + generalization.forEach(item => { + item.richText = true + item.resetRichText = true + }) + } if (root.children && root.children.length > 0) { Array.from(root.children).forEach(item => { walk(item)