Skip to content

Commit

Permalink
setLinksToOpenInNewTab : aussi après click
Browse files Browse the repository at this point in the history
  • Loading branch information
eyssette committed Oct 16, 2024
1 parent 85e1c85 commit 6710ab7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/lib/Mindmap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
}
const debouncedCurvesToLines = debounce(curvesToLines, 500);
function setLinksToOpenInNewTab() {
const links = mindmap.querySelectorAll('a');
links.forEach(link => {
link.setAttribute('target', '_blank');
});
}
afterUpdate(() => {
const transformer = new Transformer();
Expand Down Expand Up @@ -139,11 +146,8 @@
document.body.addEventListener("keyup", debouncedCurvesToLines);
}
if(openLinksInNewTab) {
const links = mindmap.querySelectorAll('a');
links.forEach(link => {
link.setAttribute('target', '_blank');
});
if(openLinksInNewTab) {
setLinksToOpenInNewTab()
}
Expand All @@ -163,6 +167,10 @@
return
} else {
if(elementType =='circle') {
// On gère à nouveau l'ouverture des liens dans un autre onglet si on utilise cette option dans le yaml
if(openLinksInNewTab) {
setLinksToOpenInNewTab()
}
// On gère à nouveau la conversion en lignes droites si besoin
if (curves === false) {
debouncedCurvesToLines();
Expand Down

0 comments on commit 6710ab7

Please sign in to comment.