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
72.72k stars 6.63k forks source link

Allow links in Gantt Chart to be opened in new tab #3326

Open djadmin opened 2 years ago

djadmin commented 2 years ago

Describe the bug

Links in Gantt charts are opened in the same browser tab. This causes an issue when diagrams are rendered in an iframe, for example Mermaid Live Editor.

Expected behavior

If it is possible to change this by adding a link target to the click definition (_self, _blank, _parent and _top), it'd be a great workaround. Flow Chart supports that feature.

Bug

 gantt
      dateFormat  YYYY-MM-DD

      section Clickable
      Visit mermaidjs           :active, cl1, 2014-01-07, 3d
      Print arguments         :cl2, after cl1, 3d
      Print task              :cl3, after cl2, 3d

      click cl1 href "https://mermaidjs.github.io/"

The visit mermaidjs link wouldn't work correctly on GitHub because it's rendered inside an iframe. See below

 gantt
      dateFormat  YYYY-MM-DD

      section Clickable
      Visit mermaidjs           :active, cl1, 2014-01-07, 3d
      Print arguments         :cl2, after cl1, 3d
      Print task              :cl3, after cl2, 3d

      click cl1 href "https://mermaidjs.github.io/"
borisklimenkovgr commented 1 year ago

Any updates on this issue? It really breaks Gitlab experience (see https://gitlab.com/gitlab-org/gitlab/-/issues/354010).

ykatchou commented 1 year ago

I guess we need to "port" https://github.com/mermaid-js/mermaid/pull/1585 to this chart as well. Can we use the same "code/spirit" or should it be done differently?