From 5f7b4e56ede79feeb09c514a2583cbc3226bb41f Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 11 Jan 2021 21:50:31 +0800 Subject: [PATCH] enhance: use command-. and command-, for mac users Related thread: https://discuss.logseq.com/t/non-default-keyboard-shortcuts-to-move-between-words-on-mac-os/135 --- src/main/frontend/components/onboarding.cljs | 4 ++-- src/main/frontend/keyboards.cljs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/frontend/components/onboarding.cljs b/src/main/frontend/components/onboarding.cljs index 093972c45..04ce3adb0 100644 --- a/src/main/frontend/components/onboarding.cljs +++ b/src/main/frontend/components/onboarding.cljs @@ -237,8 +237,8 @@ [:tr [:td (t :help/new-line-in-block)] [:td "Shift-Enter"]] [:tr [:td (t :undo)] [:td (util/->platform-shortcut "Ctrl-z")]] [:tr [:td (t :redo)] [:td (util/->platform-shortcut "Ctrl-y")]] - [:tr [:td (t :help/zoom-in)] [:td (util/->platform-shortcut "Alt-Right")]] - [:tr [:td (t :help/zoom-out)] [:td (util/->platform-shortcut "Alt-left")]] + [:tr [:td (t :help/zoom-in)] [:td (util/->platform-shortcut (if util/mac? "Alt-." "Alt-Right"))]] + [:tr [:td (t :help/zoom-out)] [:td (util/->platform-shortcut (if util/mac? "Alt-," "Alt-left"))]] [:tr [:td (t :help/follow-link-under-cursor)] [:td (util/->platform-shortcut "Ctrl-o")]] [:tr [:td (t :help/open-link-in-sidebar)] [:td (util/->platform-shortcut "Ctrl-shift-o")]] [:tr [:td (t :expand)] [:td (util/->platform-shortcut "Ctrl-Down")]] diff --git a/src/main/frontend/keyboards.cljs b/src/main/frontend/keyboards.cljs index 793d36266..091ec22f4 100644 --- a/src/main/frontend/keyboards.cljs +++ b/src/main/frontend/keyboards.cljs @@ -60,8 +60,10 @@ "ctrl+y" history-handler/redo! "ctrl+u" route-handler/go-to-search! "alt+j" route-handler/go-to-journals! - (or (state/get-shortcut :editor/zoom-in) "alt+right") editor-handler/zoom-in! - (or (state/get-shortcut :editor/zoom-out) "alt+left") editor-handler/zoom-out! + (or (state/get-shortcut :editor/zoom-in) + (if util/mac? "alt+." "alt+right")) editor-handler/zoom-in! + (or (state/get-shortcut :editor/zoom-out) + (if util/mac? "alt+," "alt+left")) editor-handler/zoom-out! "ctrl+enter" editor-handler/cycle-todo! "ctrl+down" editor-handler/expand! "ctrl+up" editor-handler/collapse!