Skip to content

Build your personal knowledge base with Trilium Notes

use CMD/meta key for opening link in a new tab on mac, #3303

zadam1b242a905be1
diff --git a/src/public/app/services/link.js b/src/public/app/services/link.js
index f8dc73d2d5..fabfc26288 100644
--- a/src/public/app/services/link.js
+++ b/src/public/app/services/link.js
@@ -97,8 +97,10 @@ function goToLink(e) {
const notePath = getNotePathFromLink($link);
+ const ctrlKey = (!utils.isMac() && e.ctrlKey) || (utils.isMac() && e.metaKey);
+
if (notePath) {
- if ((e.which === 1 && e.ctrlKey) || e.which === 2) {
+ if ((e.which === 1 && ctrlKey) || e.which === 2) {
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
}
else if (e.which === 1) {
@@ -116,7 +118,7 @@ function goToLink(e) {
}
}
else {
- if ((e.which === 1 && e.ctrlKey) || e.which === 2
+ if ((e.which === 1 && ctrlKey) || e.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
) {
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index 561189882b..576aa7da75 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -343,7 +343,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
node.setFocus(true);
}
- else if (event.ctrlKey) {
+ else if ((!utils.isMac() && event.ctrlKey) || (utils.isMac() && event.metaKey)) {
const notePath = treeService.getNotePath(node);
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
}