Watch DOM changes to add external link icons to new external links
This commit is contained in:
parent
7f4996c908
commit
10d5d16967
@ -11,6 +11,7 @@
|
||||
|
||||
document.querySelectorAll('a[target="_blank"]').forEach(el => {
|
||||
if (!el.classList.contains('no-icon')) {
|
||||
el.classList.add('no-icon');
|
||||
el.appendChild(iconElement.cloneNode(true));
|
||||
}
|
||||
});
|
||||
@ -18,6 +19,13 @@
|
||||
|
||||
onMount(() => {
|
||||
addExternalLinkIcons();
|
||||
|
||||
new MutationObserver(() => {
|
||||
addExternalLinkIcons();
|
||||
}).observe(document.body, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user