From 9029d181780ecb8ccc84312fd504195aedbb0bdf Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 26 Dec 2017 09:10:54 -0500 Subject: [PATCH] fix go to external link by double clicking --- public/javascripts/link.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/public/javascripts/link.js b/public/javascripts/link.js index 046d850a8..a74ce9b70 100644 --- a/public/javascripts/link.js +++ b/public/javascripts/link.js @@ -42,18 +42,20 @@ const link = (function() { e.preventDefault(); const linkEl = $(e.target); - const notePath = linkEl.attr("note-path") ? linkEl.attr("note-path") : getNotePathFromLink(linkEl.attr('href')); + const address = linkEl.attr("note-path") ? linkEl.attr("note-path") : linkEl.attr('href'); - if (!notePath) { + if (!address) { return; } - if (notePath.startsWith('http')) { - window.open(notePath, '_blank'); + 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 @@ -84,8 +86,8 @@ const link = (function() { // when click on link popup, in case of internal link, just go the the referenced note instead of default behavior // of opening the link in new window/tab $(document).on('click', "a[action='note']", goToLink); - $(document).on('click', 'div.popover-content a, div.ui-tooltip-content', goToLink); - $(document).on('dblclick', '#note-detail a, div.ui-tooltip-content', goToLink); + $(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink); + $(document).on('dblclick', '#note-detail a', goToLink); return { getNodePathFromLabel,