From 4cd57d632d1fe28f40b1d3aeb25d1636549c6b70 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 30 Oct 2024 17:00:36 +0100 Subject: [PATCH] fix(mermaid): No custom link handling for links in mermaid diagrams This fixes clicking links in mermaid diagrams in Collectives. See the issue that gets fixed by this for a reproducer. Fixes: nextcloud/collectives#1135 Signed-off-by: Jonas --- src/plugins/links.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/links.js b/src/plugins/links.js index c7545189ea8..293858bbe94 100644 --- a/src/plugins/links.js +++ b/src/plugins/links.js @@ -158,6 +158,11 @@ export function linkClicking() { click: (view, event) => { const linkEl = event.target.closest('a') if (event.button === 0 && linkEl) { + // No special handling in mermaid diagrams to not break links there + if (linkEl.closest('svg[id^="mermaid-view"]')) { + return false + } + event.preventDefault() if (isLinkToSelfWithHash(linkEl.attributes.href?.value)) { // Open anchor links directly