From 7d380a8c1f87e8185beed8fea16c7862371f2807 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 f090de3eba9..56f02de35ff 100644 --- a/src/plugins/links.js +++ b/src/plugins/links.js @@ -175,6 +175,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