From 3b4195acc57919858adde7be6a8205856018746a 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: Mon, 25 Mar 2024 15:38:19 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E8=8A=82=E7=82=B9=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E6=96=B0=E5=A2=9EgetAncestorNodes=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E8=8E=B7=E5=8F=96=E7=A5=96=E5=85=88=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index 09166261..80863b74 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -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()