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

This commit is contained in:
zadam 2022-11-10 23:16:41 +01:00
parent c6e766f5c6
commit 1b242a905b
2 changed files with 5 additions and 3 deletions

View File

@ -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
) {

View File

@ -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);
}