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()