From 3ff3021acd91d55f767c266f61e54b808812a8eb Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 9 Jan 2019 21:42:16 +0100 Subject: [PATCH] shortcuts for mac should use cmd instead of ctrl, closes #290 --- src/public/javascripts/desktop.js | 7 ------- src/public/javascripts/services/entrypoints.js | 4 ---- src/public/javascripts/services/utils.js | 5 +++++ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.js index 24ef4c151..f81e11cd3 100644 --- a/src/public/javascripts/desktop.js +++ b/src/public/javascripts/desktop.js @@ -117,13 +117,6 @@ function exec(cmd) { } if (utils.isElectron() && utils.isMac()) { - utils.bindShortcut('ctrl+c', () => exec("copy")); - utils.bindShortcut('ctrl+v', () => exec('paste')); - utils.bindShortcut('ctrl+x', () => exec('cut')); - utils.bindShortcut('ctrl+a', () => exec('selectAll')); - utils.bindShortcut('ctrl+z', () => exec('undo')); - utils.bindShortcut('ctrl+y', () => exec('redo')); - utils.bindShortcut('meta+c', () => exec("copy")); utils.bindShortcut('meta+v', () => exec('paste')); utils.bindShortcut('meta+x', () => exec('cut')); diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js index fbbc6fbbe..559b90fe1 100644 --- a/src/public/javascripts/services/entrypoints.js +++ b/src/public/javascripts/services/entrypoints.js @@ -117,10 +117,6 @@ function registerEntrypoints() { utils.bindShortcut('ctrl+f', openInPageSearch); - if (utils.isMac()) { - utils.bindShortcut('meta+f', openInPageSearch); - } - // FIXME: do we really need these at this point? utils.bindShortcut("ctrl+shift+up", () => { const node = treeService.getCurrentNode(); diff --git a/src/public/javascripts/services/utils.js b/src/public/javascripts/services/utils.js index 7856cdbec..013f4225e 100644 --- a/src/public/javascripts/services/utils.js +++ b/src/public/javascripts/services/utils.js @@ -137,6 +137,11 @@ function randomString(len) { function bindShortcut(keyboardShortcut, handler) { if (isDesktop()) { + if (isMac()) { + // use CMD (meta) instead of CTRL for all shortcuts + keyboardShortcut = keyboardShortcut.replace("ctrl", "meta"); + } + $(document).bind('keydown', keyboardShortcut, e => { handler();