mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 16:55:50 +01:00
note launchers by default open in the active note context but follow the same logic with ctrl/middle click as links
This commit is contained in:
@@ -90,27 +90,27 @@ function getNotePathFromLink($link) {
|
||||
return url ? getNotePathFromUrl(url) : null;
|
||||
}
|
||||
|
||||
function goToLink(e) {
|
||||
const $link = $(e.target).closest("a,.block-link");
|
||||
function goToLink(evt) {
|
||||
const $link = $(evt.target).closest("a,.block-link");
|
||||
const address = $link.attr('href');
|
||||
|
||||
if (address?.startsWith("data:")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
|
||||
const notePath = getNotePathFromLink($link);
|
||||
|
||||
const ctrlKey = (!utils.isMac() && e.ctrlKey) || (utils.isMac() && e.metaKey);
|
||||
const ctrlKey = utils.isCtrlKey(evt);
|
||||
|
||||
if (notePath) {
|
||||
if ((e.which === 1 && ctrlKey) || e.which === 2) {
|
||||
if ((evt.which === 1 && ctrlKey) || evt.which === 2) {
|
||||
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||
}
|
||||
else if (e.which === 1) {
|
||||
const ntxId = $(e.target).closest("[data-ntx-id]").attr("data-ntx-id");
|
||||
else if (evt.which === 1) {
|
||||
const ntxId = $(evt.target).closest("[data-ntx-id]").attr("data-ntx-id");
|
||||
|
||||
const noteContext = ntxId
|
||||
? appContext.tabManager.getNoteContextById(ntxId)
|
||||
@@ -124,7 +124,7 @@ function goToLink(e) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((e.which === 1 && ctrlKey) || e.which === 2
|
||||
if ((evt.which === 1 && ctrlKey) || evt.which === 2
|
||||
|| $link.hasClass("ck-link-actions__preview") // within edit link dialog single click suffices
|
||||
|| $link.closest("[contenteditable]").length === 0 // outside of CKEditor single click suffices
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user