Merge branch 'master' into enhance/keymaps-manager-x

This commit is contained in:
charlie
2023-05-19 10:20:20 +08:00
68 changed files with 8988 additions and 8606 deletions

View File

@@ -16,7 +16,7 @@
[frontend.handler.whiteboard :as whiteboard-handler]
[frontend.handler.plugin-config :as plugin-config-handler]
[frontend.modules.editor.undo-redo :as undo-redo]
[frontend.modules.shortcut.dicts :as dicts]
[frontend.dicts :as dicts]
[frontend.modules.shortcut.before :as m]
[frontend.state :as state]
[frontend.util :refer [mac?] :as util]
@@ -33,7 +33,7 @@
;; with other config keys
;; To add a new entry to this map, first add it here and then a description for
;; it in frontend.modules.shortcut.dicts/all-default-keyboard-shortcuts.
;; it under :commands keys of frontend.dicts.en/dicts
;; A shortcut is a map with the following keys:
;; * :binding - A string representing a keybinding. Avoid using single letter
;; shortcuts to allow chords that start with those characters
@@ -330,7 +330,8 @@
:editor/zoom-out {:binding (if mac? "mod+," "alt+left")
:fn editor-handler/zoom-out!}
:editor/toggle-undo-redo-mode {:fn undo-redo/toggle-undo-redo-mode!}
:editor/toggle-undo-redo-mode {:binding false
:fn undo-redo/toggle-undo-redo-mode!}
:editor/toggle-number-list {:binding "t n"
:fn #(state/pub-event! [:editor/toggle-own-number-list (state/get-selection-block-ids)])}
@@ -538,12 +539,12 @@
:inactive (not (state/developer-mode?))
:fn :frontend.handler.common.developer/show-page-ast}})
(let [keyboard-shortcuts
{::keyboard-shortcuts (set (keys all-default-keyboard-shortcuts))
::dicts/keyboard-shortcuts (set (keys dicts/all-default-keyboard-shortcuts))}]
(assert (= (::keyboard-shortcuts keyboard-shortcuts) (::dicts/keyboard-shortcuts keyboard-shortcuts))
(str "Keys for keyboard shortcuts must be the same "
(data/diff (::keyboard-shortcuts keyboard-shortcuts) (::dicts/keyboard-shortcuts keyboard-shortcuts)))))
(let [keyboard-commands
{::commands (set (keys all-default-keyboard-shortcuts))
::dicts/commands dicts/abbreviated-commands}]
(assert (= (::commands keyboard-commands) (::dicts/commands keyboard-commands))
(str "Keyboard commands must have an english label"
(data/diff (::commands keyboard-commands) (::commands keyboard-commands)))))
(defn- resolve-fn
"Converts a keyword fn to the actual fn. The fn to be resolved needs to be
@@ -754,7 +755,7 @@
(with-meta {:before m/enable-when-not-editing-mode!}))}))
;; To add a new entry to this map, first add it here and then
;; a description for it in frontend.modules.shortcut.dicts/category
;; a description for it in frontend.dicts.en/dicts
(def ^:large-vars/data-var category*
"Full list of categories for docs purpose"
{:shortcut.category/basics
@@ -932,9 +933,9 @@
[]})
(let [category-maps {::category (set (keys category*))
::dicts/category (set (keys dicts/category))}]
::dicts/category dicts/categories}]
(assert (= (::category category-maps) (::dicts/category category-maps))
(str "Keys for category maps must be the same "
(str "Keys for category maps must have an english label "
(data/diff (::category category-maps) (::dicts/category category-maps)))))
(def category