From 24363d55a4915cdeea5b074b3d5cf2dda63edc1e 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: Fri, 6 Dec 2024 16:41:27 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E9=9D=9E=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=A8=A1=E5=BC=8F=E6=94=AF=E6=8C=81=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E5=92=8C=E6=B8=B2=E6=9F=93=E7=A9=BA=E8=A1=8C=EF=BC=9BFix?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E5=A4=8D=E9=9D=9E=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E8=8A=82=E7=82=B9=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E6=97=B6=EF=BC=8C=E8=BF=9B=E5=85=A5=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=BC=96=E8=BE=91=E6=97=B6=E6=96=87=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=A1=86=E4=BD=8D=E7=BD=AE=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/nodeCreateContents.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/simple-mind-map/src/core/render/node/nodeCreateContents.js b/simple-mind-map/src/core/render/node/nodeCreateContents.js index 3cbe44e2..d6e425bd 100644 --- a/simple-mind-map/src/core/render/node/nodeCreateContents.js +++ b/simple-mind-map/src/core/render/node/nodeCreateContents.js @@ -270,8 +270,13 @@ function createTextNode(specifyText) { } textArr[index] = lines.join('\n') }) - textArr = textArr.join('\n').split(/\n/gim) + textArr = textArr.join('\n').replace(/\n$/g, '').split(/\n/gim) textArr.forEach((item, index) => { + // 避免尾部的空行不占宽度 + // 同时解决该问题:https://github.com/wanglin2/mind-map/issues/1037 + if (item === '') { + item = '' + } const node = new Text().text(item) node.addClass('smm-text-node-wrap') this.style.text(node)