Skip to content

Attach a sub item to the root of a mindmap. #361

@dh7

Description

@dh7

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

It was not possible to attach a sub item to the root of the mindmap.

Here is the diff that solved my problem:

diff --git a/node_modules/mind-elixir/dist/MindElixir.js b/node_modules/mind-elixir/dist/MindElixir.js
index fda8cf9..cfd11b0 100644
--- a/node_modules/mind-elixir/dist/MindElixir.js
+++ b/node_modules/mind-elixir/dist/MindElixir.js
@@ -922,7 +922,7 @@ const me = document, Dt = function(e, t) {
 }, He = function(e, t) {
   for (const n of t) {
     const o = n.parentElement.parentElement.contains(e);
-    if (!(e && e.tagName === "ME-TPC" && e !== n && !o && e.nodeObj.parent)) return !1;
+    if (!(e && e.tagName === "ME-TPC" && e !== n && !o)) return !1;
   }
   return !0;
 }, Pt = function(e) {
@@ -1680,7 +1680,7 @@ function ln(e, t) {
   n !== void 0 && (n[o] = t, t.children = [e]);
 }
 function ot(e, t, n) {
-  if (nt(t), n.parent?.parent || (t.direction = n.direction), e === "in")
+  if (nt(t), !n.parent ? (t.direction = t.direction !== void 0 ? t.direction : 0) : n.parent?.parent || (t.direction = n.direction), e === "in")
     n.children ? n.children.push(t) : n.children = [t];
   else {
     t.direction !== void 0 && (t.direction = n.direction);

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions