I have started using mermaid for diagram generation. In the docs for Flowchart there is an example where interaction is added using a callback function. I have tried in various ways, but am unable to trigger the callback function. Using an external link on click does work correctly.
Even their own example in the documentation does not seem to be working (for me?). https://mermaid.js.org/syntax/flowchart.html#interaction
Am I missing something obvious?
They add a link to a jsfiddle, but again, no click callback is being triggered. https://jsfiddle.net/Lv4b9m6t/1/
html:
<pre class="mermaid">
flowchart LR
A-->B
B-->C
C-->D
click A callback "Tooltip"
click B "https://www.github.com" "This is a link"
click C call callback() "Tooltip"
click D href "https://www.github.com" "This is a link"
</pre>
javascript:
const callback = function () {
alert('A callback was triggered');
};
const config = {
logLevel: 1,
startOnLoad: true,
flowchart: { useMaxWidth: true, htmlLabels: true, curve: 'cardinal' },
securityLevel: 'loose',
};
mermaid.initialize(config);