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