open all hyperlinks in new tab

This commit is contained in:
Tomáš Mládek 2021-01-12 00:23:01 +01:00
parent f6c6e3a412
commit ea1a96acd3

View file

@ -177,6 +177,10 @@ export default defineComponent({
}); });
} }
// Links
console.debug("[SVG] Processing hyperlinks.");
processHyperlinks(svg);
// Anchors // Anchors
console.debug("[SVG] Processing anchors."); console.debug("[SVG] Processing anchors.");
anchors.value = processAnchors(svg); 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 { function processStart(svg: XMLDocument): SVGRectElement | null {
const start = svg.getElementById("start"); const start = svg.getElementById("start");
if (start) { if (start) {