fix: cross-platform shotcuts (#10590)

This PR also simplifies the implementation of shui/shortcut a lot.

* fix: consistent char for the Enter key

* fix: show ctrl instead of ⌘ for copy ref

* fix: "Ctrl" should be split from "Ctrl X"
This commit is contained in:
Tienson Qin
2023-12-03 12:40:08 +08:00
committed by GitHub
parent 95461d8a8a
commit ecde2c3bfc
6 changed files with 93 additions and 99 deletions

View File

@@ -665,8 +665,8 @@
(shui/shortcut "/" context)
[:div "to filter search results"]]
[:div.flex.flex-row.gap-1.items-center.opacity-50.hover:opacity-100
(shui/shortcut "mod enter" context)
[:div "to open search in the sidebar"]]]))
(shui/shortcut ["mod" "enter"] context)
[:div "to open search in the sidebar"]]]) )
(rum/defcs tip <
{:init (fn [state]

View File

@@ -459,7 +459,7 @@
(cond
(or unset? user-binding (false? user-binding))
[:code.dark:bg-green-800.bg-green-300
[:code
(if unset?
(t :keymap/unset)
(str (t :keymap/custom) ": "

View File

@@ -140,10 +140,10 @@
(let [tmp (cond
(false? binding)
(cond
(and util/mac? (= k :editor/kill-line-after)) "system default: ctrl k"
(and util/mac? (= k :editor/beginning-of-block)) "system default: ctrl a"
(and util/mac? (= k :editor/end-of-block)) "system default: ctrl e"
(and util/mac? (= k :editor/backward-kill-word)) "system default: opt delete"
(and util/mac? (= k :editor/kill-line-after)) "ctrl k"
(and util/mac? (= k :editor/beginning-of-block)) "ctrl a"
(and util/mac? (= k :editor/end-of-block)) "ctrl e"
(and util/mac? (= k :editor/backward-kill-word)) "opt delete"
:else (t :keymap/disabled))
(string? binding)