From ea1a96acd37e4da2e60b14fdd30be22f0176e18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Tue, 12 Jan 2021 00:23:01 +0100 Subject: [PATCH] open all hyperlinks in new tab --- app/src/components/SVGContent.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/components/SVGContent.vue b/app/src/components/SVGContent.vue index 14c07e4..98f2f70 100644 --- a/app/src/components/SVGContent.vue +++ b/app/src/components/SVGContent.vue @@ -177,6 +177,10 @@ export default defineComponent({ }); } + // Links + console.debug("[SVG] Processing hyperlinks."); + processHyperlinks(svg); + // Anchors console.debug("[SVG] Processing anchors."); anchors.value = processAnchors(svg); @@ -365,6 +369,12 @@ function processAudio(svg: XMLDocument): AudioAreaDef[] { }); } +function processHyperlinks(svg: XMLDocument) { + Array.from(svg.getElementsByTagName("a")).forEach((el) => { + el.setAttribute("target", "_blank"); + }); +} + function processStart(svg: XMLDocument): SVGRectElement | null { const start = svg.getElementById("start"); if (start) {