mirror of
https://github.com/zadam/trilium.git
synced 2024-12-25 00:34:08 +08:00
fix go to external link by double clicking
This commit is contained in:
parent
e9a1791e3d
commit
9029d18178
1 changed files with 8 additions and 6 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue