From c499473467e2e25aaee0a610612251d655e4caf1 Mon Sep 17 00:00:00 2001 From: "Helmut K. C. Tessarek" Date: Mon, 13 Dec 2021 05:38:12 -0500 Subject: [PATCH] All: fixes #5801: Links in flowchart Mermaid diagrams (#5830) --- packages/app-desktop/gui/note-viewer/lib.js | 2 ++ packages/lib/renderers/webviewLib.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/app-desktop/gui/note-viewer/lib.js b/packages/app-desktop/gui/note-viewer/lib.js index 7ac0d8ffb..b5e3c2353 100644 --- a/packages/app-desktop/gui/note-viewer/lib.js +++ b/packages/app-desktop/gui/note-viewer/lib.js @@ -202,6 +202,8 @@ document.addEventListener('click', function(event) { if (webviewLib.handleInternalLink(event, anchor)) return; event.preventDefault(); if (anchor.getAttribute('href')) webviewLib.options_.postMessage(anchor.getAttribute('href')); + // Depending on the chart type, the generated SVG contains an anchor element with xlink:href attribute. + if (anchor.getAttribute('xlink:href')) webviewLib.options_.postMessage(anchor.getAttribute('xlink:href')); return; } diff --git a/packages/lib/renderers/webviewLib.js b/packages/lib/renderers/webviewLib.js index cec51d7ab..5dc11640e 100644 --- a/packages/lib/renderers/webviewLib.js +++ b/packages/lib/renderers/webviewLib.js @@ -104,6 +104,8 @@ document.addEventListener('click', function(event) { if (webviewLib.handleInternalLink(event, anchor)) return; event.preventDefault(); if (anchor.getAttribute('href')) webviewLib.options_.postMessage(anchor.getAttribute('href')); + // Depending on the chart type, the generated SVG contains an anchor element with xlink:href attribute. + if (anchor.getAttribute('xlink:href')) webviewLib.options_.postMessage(anchor.getAttribute('xlink:href')); return; }