Skip to content

Commit

Permalink
Feat:节点实例新增getAncestorNodes方法用于获取祖先节点列表
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglin2 committed Mar 25, 2024
1 parent 8b68b1f commit 3b4195a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions simple-mind-map/src/core/render/node/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,17 @@ class Node {
return copyNodeTree({}, this, removeActiveState, removeId)
}

// 获取祖先节点列表
getAncestorNodes() {
const list = []
let parent = this.parent
while (parent) {
list.unshift(parent)
parent = parent.parent
}
return list
}

// 是否存在自定义样式
hasCustomStyle() {
return this.style.hasCustomStyle()
Expand Down

0 comments on commit 3b4195a

Please sign in to comment.