From fbb3b47b7db24633944cf93d64cea64dfc74af30 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: Tue, 3 Dec 2024 17:52:23 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E4=BF=AE=E6=94=B9tryAddHtmlStyle?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/core/render/node/nodeCreateContents.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/simple-mind-map/src/core/render/node/nodeCreateContents.js b/simple-mind-map/src/core/render/node/nodeCreateContents.js index 31b1c4f3..3cbe44e2 100644 --- a/simple-mind-map/src/core/render/node/nodeCreateContents.js +++ b/simple-mind-map/src/core/render/node/nodeCreateContents.js @@ -127,14 +127,15 @@ function createIconNode() { // 尝试给html指定标签添加内联样式 function tryAddHtmlStyle(text, style) { const tagList = ['span', 'strong', 's', 'em', 'u'] - let _text = text - for (let i = 0; i < tagList.length; i++) { - text = addHtmlStyle(text, tagList[i], style) - if (text !== _text) { - break - } - } - return text + // let _text = text + // for (let i = 0; i < tagList.length; i++) { + // text = addHtmlStyle(text, tagList[i], style) + // if (text !== _text) { + // break + // } + // } + // return text + return addHtmlStyle(text, tagList, style) } // 创建富文本节点