mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
70.65k stars 6.32k forks source link

Add click interactions to MindMap #4099

Open quan787 opened 1 year ago

quan787 commented 1 year ago

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

ishaan812 commented 1 year ago

Can I be assigned this issue?

ZainGulbaz commented 1 year ago

@jgreywolf Can you please assign this to me?

jgreywolf commented 1 year ago

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

spalukuri commented 8 months ago

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

garwalsh commented 7 months ago

Also hoping for this!

baba43 commented 6 months ago

Please make this happen! 👍

ShawnBrew commented 5 months ago

This would be great.

marabesi commented 5 months ago

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

threedaysmore commented 4 months ago

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 commented 4 months ago

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
baba43 commented 4 months ago

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?

threedaysmore commented 4 months ago

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.

sauron918 commented 1 month ago

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

marabesi commented 1 month ago

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

AndrewBarfield commented 1 month ago

Not working in v10.9.1. We really need this. How can I help?