mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
right click on external link should not open the link, fixes #3971
This commit is contained in:
parent
6878877acd
commit
ad4631018a
@ -105,11 +105,14 @@ function goToLink(evt) {
|
|||||||
|
|
||||||
const ctrlKey = utils.isCtrlKey(evt);
|
const ctrlKey = utils.isCtrlKey(evt);
|
||||||
|
|
||||||
|
const leftClick = evt.which === 1;
|
||||||
|
const middleClick = evt.which === 2;
|
||||||
|
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
if ((evt.which === 1 && ctrlKey) || evt.which === 2) {
|
if ((leftClick && ctrlKey) || middleClick) {
|
||||||
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||||
}
|
}
|
||||||
else if (evt.which === 1) {
|
else if (leftClick) {
|
||||||
const ntxId = $(evt.target).closest("[data-ntx-id]").attr("data-ntx-id");
|
const ntxId = $(evt.target).closest("[data-ntx-id]").attr("data-ntx-id");
|
||||||
|
|
||||||
const noteContext = ntxId
|
const noteContext = ntxId
|
||||||
@ -124,9 +127,12 @@ function goToLink(evt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((evt.which === 1 && ctrlKey) || evt.which === 2
|
const withinEditLink = $link.hasClass("ck-link-actions__preview");
|
||||||
|| $link.hasClass("ck-link-actions__preview") // within edit link dialog single click suffices
|
const outsideOfCKEditor = $link.closest("[contenteditable]").length === 0;
|
||||||
|| $link.closest("[contenteditable]").length === 0 // outside of CKEditor single click suffices
|
|
||||||
|
if ((leftClick && ctrlKey) || middleClick
|
||||||
|
|| (withinEditLink && (leftClick || middleClick))
|
||||||
|
|| (outsideOfCKEditor && (leftClick || middleClick))
|
||||||
) {
|
) {
|
||||||
if (address) {
|
if (address) {
|
||||||
if (address.toLowerCase().startsWith('http')) {
|
if (address.toLowerCase().startsWith('http')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user