From 550bb77ca9a2104fa8b18c1cc27f8dcf53a36f66 Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 2 Jan 2018 20:16:17 -0500 Subject: [PATCH] fixed switching between note clones --- public/javascripts/link.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/public/javascripts/link.js b/public/javascripts/link.js index a74ce9b70..29041a436 100644 --- a/public/javascripts/link.js +++ b/public/javascripts/link.js @@ -42,20 +42,24 @@ const link = (function() { e.preventDefault(); const linkEl = $(e.target); - const address = linkEl.attr("note-path") ? linkEl.attr("note-path") : linkEl.attr('href'); + let notePath = linkEl.attr("note-path"); - if (!address) { - return; + if (!notePath) { + const address = linkEl.attr("note-path") ? linkEl.attr("note-path") : linkEl.attr('href'); + + if (!address) { + return; + } + + if (address.startsWith('http')) { + window.open(address, '_blank'); + + return; + } + + notePath = getNotePathFromLink(address); } - if (address.startsWith('http')) { - window.open(address, '_blank'); - - return; - } - - const notePath = getNotePathFromLink(address); - noteTree.activateNode(notePath); // this is quite ugly hack, but it seems like we can't close the tooltip otherwise