mermaid icon indicating copy to clipboard operation
mermaid copied to clipboard

Add click interactions to MindMap

Open quan787 opened this issue 2 years ago • 16 comments

Proposal

There are features for interactions in some other types of diagrams, e.g. Flowchart, Class Diagram. This helps a lot for linking pages together as a intuitive and organized way.

However, MindMap does not have that yet. This type of diagram is particularly suitable for doc and wiki websites, where it really need to add url links to nodes.

I am using wiki.js to build a wiki website, and really want this kind of diagrams to be shown at the front page.

Right now, the link syntax similar to other types are ignored:

image

Example

Syntaxes like this are needed:

mindmap
root((Variable stars))
 Pulsation 
 link Pulsation "github.com" "something"
 Cataclysmic

Screenshots

No response

quan787 avatar Feb 16 '23 19:02 quan787

Can I be assigned this issue?

ishaan812 avatar Apr 05 '23 21:04 ishaan812

@jgreywolf Can you please assign this to me?

ZainGulbaz avatar Aug 01 '23 09:08 ZainGulbaz

A month later - sorry for the delay. Are you still interested in working on this?

jgreywolf avatar Aug 26 '23 20:08 jgreywolf

hi, I am really looking forward to this any update on this. Thanks for the great work!

spalukuri avatar Jan 01 '24 19:01 spalukuri

Also hoping for this!

garwalsh avatar Feb 14 '24 02:02 garwalsh

Please make this happen! 👍

baba43 avatar Feb 25 '24 12:02 baba43

This would be great.

ShawnBrew avatar Mar 26 '24 17:03 ShawnBrew

I was looking for the same thing, and this answer from stackoverflow did the trick.

marabesi avatar Apr 01 '24 16:04 marabesi

I was looking for the same thing, and this answer from stackoverflow did the trick.

Any chance you can provide how this answer achieved this for you for mindmaps? I've tried adding securityLevel: loose and adding in clicks or anchor tags in a node with no success.

threedaysmore avatar Apr 17 '24 02:04 threedaysmore

So I had to put something together that would get this off the ground for a small personal project. I made a small react app that takes in a mermaid mindmap doc with comments for each node's link and adds click listeners. It's by no means a particularly masterful solution since I am not a masterful JS dev 😅

A note for devs: this is just manipulating the DOM after render as best as the Mermaid package will allow me. This could be done smoother/better directly in the mermaid package/code I'm sure.

But hopefully this is a stepping stone for someone else who comes to this thread later.

Here is the example site deployed to Netlify repo link

And here is the mermaid doc used to generate this mindmap

mindmap
  root((TV Shows))
    Frasier %% https://en.wikipedia.org/wiki/Frasier
      Frasier %%https://en.wikipedia.org/wiki/Frasier_Crane
      Daphne %%https://en.wikipedia.org/wiki/Daphne_Moon
      Niles  %%https://en.wikipedia.org/wiki/Niles_Crane
      Martin %%https://en.wikipedia.org/wiki/Martin_Crane
    Avatar the Last Airbender %%https://en.wikipedia.org/wiki/Avatar:_The_Last_Airbender
      Aang %%https://en.wikipedia.org/wiki/Aang
      Katara %%https://en.wikipedia.org/wiki/Katara_(Avatar:_The_Last_Airbender)
      Sokka %%https://en.wikipedia.org/wiki/Sokka
      Zuko %%https://en.wikipedia.org/wiki/Zuko
      Iroh %%https://en.wikipedia.org/wiki/Iroh
    Game of Thrones %%https://en.wikipedia.org/wiki/Game_of_Thrones
      Jon Snow %%https://en.wikipedia.org/wiki/Jon_Snow_(character)
      Ned Stark %%https://en.wikipedia.org/wiki/Ned_Stark
      Tyrion Lanister %%https://en.wikipedia.org/wiki/Tyrion_Lannister
    Scrubs %%https://en.wikipedia.org/wiki/Scrubs_(TV_series)
      Turk %%https://en.wikipedia.org/wiki/Christopher_Turk
      JD %%https://en.wikipedia.org/wiki/J.D._(Scrubs)
      Elliot %%https://en.wikipedia.org/wiki/Elliot_Reid
      Dr. Cox %%https://en.wikipedia.org/wiki/Perry_Cox

threedaysmore avatar Apr 22 '24 19:04 threedaysmore

I was looking for the same thing, and this answer from stackoverflow did the trick.

Any chance you can provide how this answer achieved this for you for mindmaps? I've tried adding securityLevel: loose and adding in clicks or anchor tags in a node with no success.

Same here. Did you find a solution? Maybe this is just not working for the Mindmap in general?

baba43 avatar Apr 25 '24 15:04 baba43

Same here. Did you find a solution? Maybe this is just not working for the Mindmap in general?

Best I can tell clickable links are not natively supported for Mindmaps. In this previous reply of mine I've got some code out there to show how to kind of shoehorn it in there for now until mermaid(hopefully) gets some support out there for this.

threedaysmore avatar Apr 28 '24 04:04 threedaysmore

Really hope for support. Links are quite often used in mind maps.

sauron918 avatar Jul 23 '24 21:07 sauron918

update on my answer:

it worked just for flow diagrams but after trying to do that with mermaid js for mindmaps it didn't work

ping @threedaysmore

marabesi avatar Aug 06 '24 17:08 marabesi