From b20665871519a35bd9d8fbdcdb41a96031fc9cdc Mon Sep 17 00:00:00 2001 From: hellowuxin Date: Fri, 14 May 2021 15:03:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=8E=B0=E5=9C=A8=E6=8A=98=E5=8F=A0?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=8B=E4=B9=9F=E5=8F=AF=E4=BB=A5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=90=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Mindmap/data/ImData.ts | 5 +++-- src/components/Mindmap/listener/listener.ts | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Mindmap/data/ImData.ts b/src/components/Mindmap/data/ImData.ts index f708bcb..b90079b 100644 --- a/src/components/Mindmap/data/ImData.ts +++ b/src/components/Mindmap/data/ImData.ts @@ -282,8 +282,8 @@ class ImData { add (id: string, variable: string | Data): IsMdata { const p = this.find(id) - if (p && !p.collapse) { - if (!p.children) { p.children = [] } + if (p) { + if (p.collapse) { this.expand(id) } if (!p.rawData.children) { p.rawData.children = [] } if (typeof variable === 'string') { const name = variable @@ -324,6 +324,7 @@ class ImData { return m } } + return null } diff --git a/src/components/Mindmap/listener/listener.ts b/src/components/Mindmap/listener/listener.ts index 6d9f22c..eba57cf 100644 --- a/src/components/Mindmap/listener/listener.ts +++ b/src/components/Mindmap/listener/listener.ts @@ -89,7 +89,6 @@ export const onContextmenu = (e: MouseEvent): void => { const isRoot = classList.contains(style.root) const collapseFlag = classList.contains(style['collapse']) if (!classList.contains(style.selected)) { selectGNode(gNode as SVGGElement) } - ctm.addItem.value.disabled = collapseFlag ctm.deleteItem.value.disabled = isRoot ctm.cutItem.value.disabled = isRoot ctm.deleteOneItem.value.disabled = isRoot