open all hyperlinks in new tab

master
Tomáš Mládek 2021-01-12 00:23:01 +01:00
parent f6c6e3a412
commit ea1a96acd3
1 changed files with 10 additions and 0 deletions

View File

@ -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) {