From b0dd90f5b349cc0620e3c09e7a707abf6e797168 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Thu, 19 Oct 2023 10:47:53 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E8=8A=82=E7=82=B9=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0getPureData=E6=96=B9=E6=B3=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=AF=A5=E8=8A=82=E7=82=B9=E7=9A=84=E7=BA=AF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index f4eb0868..4c1c3310 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -1,6 +1,6 @@ import Style from './Style' import Shape from './Shape' -import { G, ForeignObject, SVG, Rect } from '@svgdotjs/svg.js' +import { G, ForeignObject, Rect } from '@svgdotjs/svg.js' import nodeGeneralizationMethods from './nodeGeneralization' import nodeExpandBtnMethods from './nodeExpandBtn' import nodeCommandWrapsMethods from './nodeCommandWraps' @@ -8,6 +8,7 @@ import nodeCreateContentsMethods from './nodeCreateContents' import nodeExpandBtnPlaceholderRectMethods from './nodeExpandBtnPlaceholderRect' import nodeCooperateMethods from './nodeCooperate' import { CONSTANTS } from '../../../constants/constant' +import { copyNodeTree } from '../../../utils/index' // 节点类 class Node { @@ -961,6 +962,11 @@ class Node { return key ? this.nodeData.data[key] : this.nodeData.data } + // 获取该节点的纯数据,即不包含对节点实例的引用 + getPureData(removeActiveState = true, removeId = false) { + return copyNodeTree({}, this, removeActiveState, removeId) + } + // 是否存在自定义样式 hasCustomStyle() { return this.style.hasCustomStyle()