Skip to content

Commit cd08976

Browse files
committed
INTLV-24: Open links in new tab by default
Signed-off-by: wthrajat <rajatkhanduri290102@gmail.com>
1 parent ed58320 commit cd08976

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

application-interactive-link-visualizer-webjar/src/main/resources/src/main.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,22 @@ renderer.getMouseCaptor().on("mouseup", (event) => {
426426
}
427427
});
428428

429-
// On click, we open the corresponding page URL
430-
renderer.on("clickNode", ({ node }) => {
431-
if (!graph.getNodeAttribute(node, "hidden") && allowClick) {
432-
window.open(graph.getNodeAttribute(node, "pageURL"), "_self");
433-
}
434-
});
429+
/* On click, we open the corresponding page URL:
430+
In panel the links will be opened in the current tab, elsewhere in the new tab
431+
*/
432+
if(isPanel) {
433+
renderer.on("clickNode", ({ node }) => {
434+
if (!graph.getNodeAttribute(node, "hidden") && allowClick) {
435+
window.open(graph.getNodeAttribute(node, "pageURL"), "_self");
436+
}
437+
});
438+
}
435439
if (!isPanel) {
440+
renderer.on("clickNode", ({ node }) => {
441+
if (!graph.getNodeAttribute(node, "hidden") && allowClick) {
442+
window.open(graph.getNodeAttribute(node, "pageURL"), "_blank");
443+
}
444+
});
436445
const camera = renderer.getCamera();
437446
zoomInBtn.addEventListener("click", () => {
438447
camera.animatedZoom({ duration: 600 });

0 commit comments

Comments
 (0)