mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
feat: ✨ Ensure external links open in a new tab
This commit is contained in:
parent
4afe8fc880
commit
977defc169
|
|
@ -44,6 +44,14 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|||
return `<img src="/emojis/${emojiFont}/${match}.svg" alt="${match}" class="h-[1em] inline not-prose hover:scale-110 transition-transform duration-75 ease-in-out">`;
|
||||
});
|
||||
}
|
||||
|
||||
// Make all links that don't open to the same origin open in a new tab
|
||||
for (const link of el.querySelectorAll("a")) {
|
||||
if (link.hostname !== location.hostname) {
|
||||
link.target = "_blank";
|
||||
link.rel = "noopener noreferrer";
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue