mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix go to external link by double clicking
This commit is contained in:
parent
e9a1791e3d
commit
9029d18178
@ -42,18 +42,20 @@ const link = (function() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const linkEl = $(e.target);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notePath.startsWith('http')) {
|
if (address.startsWith('http')) {
|
||||||
window.open(notePath, '_blank');
|
window.open(address, '_blank');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const notePath = getNotePathFromLink(address);
|
||||||
|
|
||||||
noteTree.activateNode(notePath);
|
noteTree.activateNode(notePath);
|
||||||
|
|
||||||
// this is quite ugly hack, but it seems like we can't close the tooltip otherwise
|
// 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
|
// 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
|
// of opening the link in new window/tab
|
||||||
$(document).on('click', "a[action='note']", goToLink);
|
$(document).on('click', "a[action='note']", goToLink);
|
||||||
$(document).on('click', 'div.popover-content 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, div.ui-tooltip-content', goToLink);
|
$(document).on('dblclick', '#note-detail a', goToLink);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getNodePathFromLabel,
|
getNodePathFromLabel,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user