|
@@ -7,7 +7,6 @@
|
|
|
[frontend.handler.editor :as editor-handler]
|
|
|
[frontend.handler.paste :as paste-handler]
|
|
|
[frontend.handler.history :as history]
|
|
|
- [frontend.handler.notification :as notification]
|
|
|
[frontend.handler.page :as page-handler]
|
|
|
[frontend.handler.route :as route-handler]
|
|
|
[frontend.handler.journal :as journal-handler]
|
|
@@ -48,8 +47,6 @@
|
|
|
;; * :fn - Fn or a qualified keyword that represents a fn
|
|
|
;; * :inactive - Optional boolean to disable a shortcut for certain conditions
|
|
|
;; e.g. a given platform or feature condition
|
|
|
-;; * :file-graph? - Optional boolean to identify a command to only be run in file graphs
|
|
|
-;; and warned gracefully in db graphs
|
|
|
(def ^:large-vars/data-var all-built-in-keyboard-shortcuts
|
|
|
;; BUG: Actually, "enter" is registered by mixin behind a "when inputing" guard
|
|
|
;; So this setting item does not cover all cases.
|
|
@@ -177,10 +174,6 @@
|
|
|
:auto-complete/shift-complete {:binding "shift+enter"
|
|
|
:fn ui-handler/auto-complete-shift-complete}
|
|
|
|
|
|
- :auto-complete/meta-complete {:binding "mod+enter"
|
|
|
- :fn (fn [state e]
|
|
|
- (ui-handler/auto-complete-complete state e))}
|
|
|
-
|
|
|
:auto-complete/open-link {:binding "mod+o"
|
|
|
:fn ui-handler/auto-complete-open-link}
|
|
|
|
|
@@ -216,7 +209,7 @@
|
|
|
:fn editor-handler/keydown-new-line-handler}
|
|
|
|
|
|
:editor/new-whiteboard {:binding "n w"
|
|
|
- :fn #(whiteboard-handler/<create-new-whiteboard-and-redirect!)}
|
|
|
+ :fn #(whiteboard-handler/create-new-whiteboard-and-redirect!)}
|
|
|
|
|
|
:editor/follow-link {:binding "mod+o"
|
|
|
:fn editor-handler/follow-link-under-cursor!}
|
|
@@ -362,11 +355,6 @@
|
|
|
:editor/toggle-number-list {:binding "t n"
|
|
|
:fn #(state/pub-event! [:editor/toggle-own-number-list (state/get-selection-block-ids)])}
|
|
|
|
|
|
- :editor/add-property {:binding "mod+p"
|
|
|
- :fn (fn [e]
|
|
|
- (.preventDefault e)
|
|
|
- (state/pub-event! [:editor/new-property]))}
|
|
|
-
|
|
|
:ui/toggle-brackets {:binding "mod+c mod+b"
|
|
|
:fn config-handler/toggle-ui-show-brackets!}
|
|
|
|
|
@@ -377,6 +365,7 @@
|
|
|
:go/search-in-page {:binding "mod+shift+k"
|
|
|
:fn #(search :current-page)}
|
|
|
|
|
|
+
|
|
|
:go/electron-find-in-page {:binding "mod+f"
|
|
|
:inactive (not (util/electron?))
|
|
|
:fn #(search-handler/open-find-in-page!)}
|
|
@@ -415,6 +404,7 @@
|
|
|
:misc/copy {:binding "mod+c"
|
|
|
:fn (fn [] (js/document.execCommand "copy"))}
|
|
|
|
|
|
+
|
|
|
:graph/export-as-html {:fn #(export-handler/download-repo-as-html!
|
|
|
(state/get-current-repo))
|
|
|
:binding []}
|
|
@@ -432,16 +422,12 @@
|
|
|
:graph/add {:fn (fn [] (route-handler/redirect! {:to :repo-add}))
|
|
|
:binding []}
|
|
|
|
|
|
- :graph/db-add {:fn #(state/pub-event! [:graph/new-db-graph])
|
|
|
- ;; TODO: Remove this once feature is released
|
|
|
- :inactive (not config/db-graph-enabled?)
|
|
|
- :binding false}
|
|
|
-
|
|
|
+ :graph/save {:fn #(state/pub-event! [:graph/save])
|
|
|
+ :binding []}
|
|
|
|
|
|
:graph/re-index {:fn (fn []
|
|
|
(p/let [multiple-windows? (ipc/ipc "graphHasMultipleWindows" (state/get-current-repo))]
|
|
|
(state/pub-event! [:graph/ask-for-re-index (atom multiple-windows?) nil])))
|
|
|
- :file-graph? true
|
|
|
:binding []}
|
|
|
|
|
|
:command/run {:binding "mod+shift+1"
|
|
@@ -506,17 +492,14 @@
|
|
|
|
|
|
:editor/open-file-in-default-app {:binding "mod+d mod+a"
|
|
|
:inactive (not (util/electron?))
|
|
|
- :file-graph? true
|
|
|
:fn page-handler/open-file-in-default-app}
|
|
|
|
|
|
:editor/open-file-in-directory {:binding "mod+d mod+i"
|
|
|
:inactive (not (util/electron?))
|
|
|
- :file-graph? true
|
|
|
:fn page-handler/open-file-in-directory}
|
|
|
|
|
|
:editor/copy-current-file {:binding false
|
|
|
:inactive (not (util/electron?))
|
|
|
- :file-graph? true
|
|
|
:fn page-handler/copy-current-file}
|
|
|
|
|
|
:editor/copy-page-url {:binding []
|
|
@@ -547,21 +530,16 @@
|
|
|
:editor/toggle-open-blocks {:binding "t o"
|
|
|
:fn editor-handler/toggle-open!}
|
|
|
|
|
|
- :ui/cycle-color-off {:binding "c o"
|
|
|
+ :ui/accent-color-reset {:binding "c o"
|
|
|
:fn state/unset-color-accent!}
|
|
|
|
|
|
- :ui/cycle-color {:binding "c c"
|
|
|
- :fn state/cycle-color!}
|
|
|
+ :ui/accent-colors-picker {:binding "c c"
|
|
|
+ :fn #(state/pub-event! [:modal/toggle-accent-colors-modal])}
|
|
|
|
|
|
:git/commit {:binding "mod+g c"
|
|
|
:inactive (not (util/electron?))
|
|
|
- :file-graph? true
|
|
|
:fn commit/show-commit-modal!}
|
|
|
|
|
|
- :dev/replace-graph-with-db-file {:binding []
|
|
|
- :inactive (or (not (util/electron?)) (not (state/developer-mode?)))
|
|
|
- :fn :frontend.handler.common.developer/replace-graph-with-db-file}
|
|
|
-
|
|
|
:dev/show-block-data {:binding []
|
|
|
:inactive (not (state/developer-mode?))
|
|
|
:fn :frontend.handler.common.developer/show-block-data}
|
|
@@ -582,8 +560,8 @@
|
|
|
{::commands (set (keys all-built-in-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)))))
|
|
|
+ (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
|
|
@@ -591,386 +569,369 @@
|
|
|
[keyword-fn]
|
|
|
(fn []
|
|
|
(if-let [resolved-fn (some-> (find-ns-obj (namespace keyword-fn))
|
|
|
- (aget (munge (name keyword-fn))))]
|
|
|
+ (aget (munge (name keyword-fn))))]
|
|
|
(resolved-fn)
|
|
|
(throw (ex-info (str "Unable to resolve " keyword-fn " to a fn") {})))))
|
|
|
|
|
|
-(defn- wrap-fn-with-file-graph-only-warning
|
|
|
- "Wraps file graph only commands so they are only run in file graphs and warned
|
|
|
- when in DB graphs"
|
|
|
- [f]
|
|
|
- (fn []
|
|
|
- (if (config/db-based-graph? (state/get-current-repo))
|
|
|
- (notification/show! "This command is only for file graphs." :warning true nil 3000)
|
|
|
- (f))))
|
|
|
-
|
|
|
(defn build-category-map [ks]
|
|
|
(->> (if (sequential? ks)
|
|
|
ks (let [{:keys [ns includes excludes]} ks]
|
|
|
(->> (keys all-built-in-keyboard-shortcuts)
|
|
|
- (filter (fn [k]
|
|
|
- (and (or (and ns (keyword? k)
|
|
|
- (contains? (->> (if (seqable? ns) (seq ns) [ns]) (map #(name %)) (set))
|
|
|
- (namespace k)))
|
|
|
- (and includes (contains? (set includes) k)))
|
|
|
- (if (not (seq excludes)) true (not (contains? (set excludes) k)))))))))
|
|
|
- (select-keys all-built-in-keyboard-shortcuts)
|
|
|
- (remove (comp :inactive val))
|
|
|
- ;; Convert keyword fns to real fns
|
|
|
- (map (fn [[k v]]
|
|
|
- [k (if (keyword? (:fn v))
|
|
|
- (assoc v :fn (resolve-fn (:fn v)))
|
|
|
- v)]))
|
|
|
- (map (fn [[k v]]
|
|
|
- [k (if (:file-graph? v)
|
|
|
- (update v :fn wrap-fn-with-file-graph-only-warning)
|
|
|
- v)]))
|
|
|
- (into {})))
|
|
|
+ (filter (fn [k]
|
|
|
+ (and (or (and ns (keyword? k)
|
|
|
+ (contains? (->> (if (seqable? ns) (seq ns) [ns]) (map #(name %)) (set))
|
|
|
+ (namespace k)))
|
|
|
+ (and includes (contains? (set includes) k)))
|
|
|
+ (if (not (seq excludes)) true (not (contains? (set excludes) k)))))))))
|
|
|
+ (select-keys all-built-in-keyboard-shortcuts)
|
|
|
+ (remove (comp :inactive val))
|
|
|
+ ;; Convert keyword fns to real fns
|
|
|
+ (map (fn [[k v]]
|
|
|
+ [k (if (keyword? (:fn v))
|
|
|
+ (assoc v :fn (resolve-fn (:fn v)))
|
|
|
+ v)]))
|
|
|
+ (into {})))
|
|
|
|
|
|
;; This is the only var that should be publicly expose :fn functionality
|
|
|
(defonce ^:large-vars/data-var *config
|
|
|
(atom
|
|
|
- {:shortcut.handler/date-picker
|
|
|
- (build-category-map {:ns :date-picker})
|
|
|
-
|
|
|
- :shortcut.handler/pdf
|
|
|
- (-> (build-category-map {:ns :pdf})
|
|
|
- (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
-
|
|
|
- :shortcut.handler/whiteboard
|
|
|
- (-> (build-category-map {:ns :whiteboard})
|
|
|
- (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
-
|
|
|
- :shortcut.handler/auto-complete
|
|
|
- (build-category-map {:ns :auto-complete})
|
|
|
-
|
|
|
- :shortcut.handler/cards
|
|
|
- (-> (build-category-map {:ns :cards})
|
|
|
- (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
-
|
|
|
- :shortcut.handler/block-editing-only
|
|
|
- (-> (build-category-map
|
|
|
- [:editor/escape-editing
|
|
|
- :editor/backspace
|
|
|
- :editor/delete
|
|
|
- :editor/zoom-in
|
|
|
- :editor/zoom-out
|
|
|
- :editor/new-block
|
|
|
- :editor/new-line
|
|
|
- :editor/follow-link
|
|
|
- :editor/open-link-in-sidebar
|
|
|
- :editor/bold
|
|
|
- :editor/italics
|
|
|
- :editor/highlight
|
|
|
- :editor/strike-through
|
|
|
- :editor/clear-block
|
|
|
- :editor/kill-line-before
|
|
|
- :editor/kill-line-after
|
|
|
- :editor/beginning-of-block
|
|
|
- :editor/end-of-block
|
|
|
- :editor/forward-word
|
|
|
- :editor/backward-word
|
|
|
- :editor/forward-kill-word
|
|
|
- :editor/backward-kill-word
|
|
|
- :editor/replace-block-reference-at-point
|
|
|
- :editor/copy-embed
|
|
|
- :editor/paste-text-in-one-block-at-point
|
|
|
- :editor/insert-youtube-timestamp])
|
|
|
- (with-meta {:before m/enable-when-editing-mode!}))
|
|
|
-
|
|
|
- :shortcut.handler/editor-global
|
|
|
- (-> (build-category-map
|
|
|
- [:graph/export-as-html
|
|
|
- :graph/open
|
|
|
- :graph/remove
|
|
|
- :graph/add
|
|
|
- :graph/db-add
|
|
|
- :graph/re-index
|
|
|
- :editor/cycle-todo
|
|
|
- :editor/up
|
|
|
- :editor/down
|
|
|
- :editor/left
|
|
|
- :editor/right
|
|
|
- :editor/select-up
|
|
|
- :editor/select-down
|
|
|
- :editor/move-block-up
|
|
|
- :editor/move-block-down
|
|
|
- :editor/open-edit
|
|
|
- :editor/select-block-up
|
|
|
- :editor/select-block-down
|
|
|
- :editor/select-parent
|
|
|
- :editor/delete-selection
|
|
|
- :editor/expand-block-children
|
|
|
- :editor/collapse-block-children
|
|
|
- :editor/indent
|
|
|
- :editor/outdent
|
|
|
- :editor/copy
|
|
|
- :editor/copy-text
|
|
|
- :editor/cut
|
|
|
- :command/toggle-favorite])
|
|
|
- (with-meta {:before m/enable-when-not-component-editing!}))
|
|
|
-
|
|
|
- :shortcut.handler/global-prevent-default
|
|
|
- (-> (build-category-map
|
|
|
- [:editor/insert-link
|
|
|
- :editor/select-all-blocks
|
|
|
- :editor/toggle-undo-redo-mode
|
|
|
- :editor/toggle-number-list
|
|
|
- :editor/undo
|
|
|
- :editor/redo
|
|
|
- :ui/toggle-brackets
|
|
|
- :go/search-in-page
|
|
|
- :go/search
|
|
|
- :go/electron-find-in-page
|
|
|
- :go/electron-jump-to-the-next
|
|
|
- :go/electron-jump-to-the-previous
|
|
|
- :go/backward
|
|
|
- :go/forward
|
|
|
- :search/re-index
|
|
|
- :sidebar/open-today-page
|
|
|
- :sidebar/clear
|
|
|
- :command/run
|
|
|
- :command-palette/toggle
|
|
|
- :editor/add-property
|
|
|
- :window/close])
|
|
|
- (with-meta {:before m/prevent-default-behavior}))
|
|
|
-
|
|
|
- :shortcut.handler/global-non-editing-only
|
|
|
- (-> (build-category-map
|
|
|
- [:go/home
|
|
|
- :go/journals
|
|
|
- :go/all-pages
|
|
|
- :go/flashcards
|
|
|
- :go/graph-view
|
|
|
- :go/all-graphs
|
|
|
- :go/whiteboards
|
|
|
- :go/keyboard-shortcuts
|
|
|
- :go/tomorrow
|
|
|
- :go/next-journal
|
|
|
- :go/prev-journal
|
|
|
- :ui/toggle-document-mode
|
|
|
- :ui/toggle-settings
|
|
|
- :ui/toggle-right-sidebar
|
|
|
- :ui/toggle-left-sidebar
|
|
|
- :ui/toggle-help
|
|
|
- :ui/toggle-theme
|
|
|
- :ui/toggle-contents
|
|
|
- :editor/open-file-in-default-app
|
|
|
- :editor/open-file-in-directory
|
|
|
- :editor/copy-current-file
|
|
|
- :editor/copy-page-url
|
|
|
- :editor/new-whiteboard
|
|
|
- :ui/toggle-wide-mode
|
|
|
- :ui/select-theme-color
|
|
|
- :ui/goto-plugins
|
|
|
- :ui/install-plugins-from-file
|
|
|
- :editor/toggle-open-blocks
|
|
|
- :ui/clear-all-notifications
|
|
|
- :git/commit
|
|
|
- :sidebar/close-top
|
|
|
- :dev/show-block-data
|
|
|
- :dev/show-block-ast
|
|
|
- :dev/show-page-data
|
|
|
- :dev/show-page-ast
|
|
|
- :dev/replace-graph-with-db-file
|
|
|
- :ui/cycle-color
|
|
|
- :ui/cycle-color-off])
|
|
|
- (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
-
|
|
|
- :shortcut.handler/misc
|
|
|
- ;; always overrides the copy due to "mod+c mod+s"
|
|
|
- {:misc/copy (:misc/copy all-built-in-keyboard-shortcuts)}}))
|
|
|
+ {:shortcut.handler/date-picker
|
|
|
+ (build-category-map {:ns :date-picker})
|
|
|
+
|
|
|
+ :shortcut.handler/pdf
|
|
|
+ (-> (build-category-map {:ns :pdf})
|
|
|
+ (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
+
|
|
|
+ :shortcut.handler/whiteboard
|
|
|
+ (-> (build-category-map {:ns :whiteboard})
|
|
|
+ (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
+
|
|
|
+ :shortcut.handler/auto-complete
|
|
|
+ (build-category-map {:ns :auto-complete})
|
|
|
+
|
|
|
+ :shortcut.handler/cards
|
|
|
+ (-> (build-category-map {:ns :cards})
|
|
|
+ (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
+
|
|
|
+ :shortcut.handler/block-editing-only
|
|
|
+ (-> (build-category-map
|
|
|
+ [:editor/escape-editing
|
|
|
+ :editor/backspace
|
|
|
+ :editor/delete
|
|
|
+ :editor/zoom-in
|
|
|
+ :editor/zoom-out
|
|
|
+ :editor/new-block
|
|
|
+ :editor/new-line
|
|
|
+ :editor/follow-link
|
|
|
+ :editor/open-link-in-sidebar
|
|
|
+ :editor/bold
|
|
|
+ :editor/italics
|
|
|
+ :editor/highlight
|
|
|
+ :editor/strike-through
|
|
|
+ :editor/clear-block
|
|
|
+ :editor/kill-line-before
|
|
|
+ :editor/kill-line-after
|
|
|
+ :editor/beginning-of-block
|
|
|
+ :editor/end-of-block
|
|
|
+ :editor/forward-word
|
|
|
+ :editor/backward-word
|
|
|
+ :editor/forward-kill-word
|
|
|
+ :editor/backward-kill-word
|
|
|
+ :editor/replace-block-reference-at-point
|
|
|
+ :editor/copy-embed
|
|
|
+ :editor/paste-text-in-one-block-at-point
|
|
|
+ :editor/insert-youtube-timestamp])
|
|
|
+ (with-meta {:before m/enable-when-editing-mode!}))
|
|
|
+
|
|
|
+ :shortcut.handler/editor-global
|
|
|
+ (-> (build-category-map
|
|
|
+ [:graph/export-as-html
|
|
|
+ :graph/open
|
|
|
+ :graph/remove
|
|
|
+ :graph/add
|
|
|
+ :graph/save
|
|
|
+ :graph/re-index
|
|
|
+ :editor/cycle-todo
|
|
|
+ :editor/up
|
|
|
+ :editor/down
|
|
|
+ :editor/left
|
|
|
+ :editor/right
|
|
|
+ :editor/select-up
|
|
|
+ :editor/select-down
|
|
|
+ :editor/move-block-up
|
|
|
+ :editor/move-block-down
|
|
|
+ :editor/open-edit
|
|
|
+ :editor/select-block-up
|
|
|
+ :editor/select-block-down
|
|
|
+ :editor/select-parent
|
|
|
+ :editor/delete-selection
|
|
|
+ :editor/expand-block-children
|
|
|
+ :editor/collapse-block-children
|
|
|
+ :editor/indent
|
|
|
+ :editor/outdent
|
|
|
+ :editor/copy
|
|
|
+ :editor/copy-text
|
|
|
+ :editor/cut
|
|
|
+ :command/toggle-favorite])
|
|
|
+ (with-meta {:before m/enable-when-not-component-editing!}))
|
|
|
+
|
|
|
+ :shortcut.handler/global-prevent-default
|
|
|
+ (-> (build-category-map
|
|
|
+ [:editor/insert-link
|
|
|
+ :editor/select-all-blocks
|
|
|
+ :editor/toggle-undo-redo-mode
|
|
|
+ :editor/toggle-number-list
|
|
|
+ :editor/undo
|
|
|
+ :editor/redo
|
|
|
+ :ui/toggle-brackets
|
|
|
+ :go/search
|
|
|
+ :go/search-in-page
|
|
|
+ :command-palette/toggle
|
|
|
+ :go/electron-find-in-page
|
|
|
+ :go/electron-jump-to-the-next
|
|
|
+ :go/electron-jump-to-the-previous
|
|
|
+ :go/backward
|
|
|
+ :go/forward
|
|
|
+ :search/re-index
|
|
|
+ :sidebar/open-today-page
|
|
|
+ :sidebar/clear
|
|
|
+ :command/run
|
|
|
+ :window/close])
|
|
|
+ (with-meta {:before m/prevent-default-behavior}))
|
|
|
+
|
|
|
+ :shortcut.handler/global-non-editing-only
|
|
|
+ (-> (build-category-map
|
|
|
+ [:go/home
|
|
|
+ :go/journals
|
|
|
+ :go/all-pages
|
|
|
+ :go/flashcards
|
|
|
+ :go/graph-view
|
|
|
+ :go/all-graphs
|
|
|
+ :go/whiteboards
|
|
|
+ :go/keyboard-shortcuts
|
|
|
+ :go/tomorrow
|
|
|
+ :go/next-journal
|
|
|
+ :go/prev-journal
|
|
|
+ :ui/toggle-document-mode
|
|
|
+ :ui/toggle-settings
|
|
|
+ :ui/toggle-right-sidebar
|
|
|
+ :ui/toggle-left-sidebar
|
|
|
+ :ui/toggle-help
|
|
|
+ :ui/toggle-theme
|
|
|
+ :ui/toggle-contents
|
|
|
+ :editor/open-file-in-default-app
|
|
|
+ :editor/open-file-in-directory
|
|
|
+ :editor/copy-current-file
|
|
|
+ :editor/copy-page-url
|
|
|
+ :editor/new-whiteboard
|
|
|
+ :ui/toggle-wide-mode
|
|
|
+ :ui/select-theme-color
|
|
|
+ :ui/goto-plugins
|
|
|
+ :ui/install-plugins-from-file
|
|
|
+ :editor/toggle-open-blocks
|
|
|
+ :ui/clear-all-notifications
|
|
|
+ :git/commit
|
|
|
+ :sidebar/close-top
|
|
|
+ :dev/show-block-data
|
|
|
+ :dev/show-block-ast
|
|
|
+ :dev/show-page-data
|
|
|
+ :dev/show-page-ast
|
|
|
+ :ui/accent-colors-picker
|
|
|
+ :ui/accent-color-reset])
|
|
|
+ (with-meta {:before m/enable-when-not-editing-mode!}))
|
|
|
+
|
|
|
+ :shortcut.handler/misc
|
|
|
+ ;; always overrides the copy due to "mod+c mod+s"
|
|
|
+ {:misc/copy (:misc/copy all-built-in-keyboard-shortcuts)}}))
|
|
|
|
|
|
;; To add a new entry to this map, first add it here and then
|
|
|
;; a description for it in frontend.dicts.en/dicts
|
|
|
;; Full list of categories for docs purpose
|
|
|
(defonce ^:large-vars/data-var *category
|
|
|
(atom
|
|
|
- {:shortcut.category/basics
|
|
|
- [:go/search
|
|
|
- :editor/new-block
|
|
|
- :editor/new-line
|
|
|
- :editor/indent
|
|
|
- :editor/outdent
|
|
|
- :editor/select-all-blocks
|
|
|
- :editor/select-parent
|
|
|
- :go/search-in-page
|
|
|
- :command-palette/toggle
|
|
|
- :go/electron-find-in-page
|
|
|
- :go/electron-jump-to-the-next
|
|
|
- :go/electron-jump-to-the-previous
|
|
|
- :editor/undo
|
|
|
- :editor/redo
|
|
|
- :editor/copy
|
|
|
- :editor/copy-text
|
|
|
- :editor/cut]
|
|
|
-
|
|
|
- :shortcut.category/formatting
|
|
|
- [:editor/bold
|
|
|
- :editor/insert-link
|
|
|
- :editor/italics
|
|
|
- :editor/strike-through
|
|
|
- :editor/highlight]
|
|
|
-
|
|
|
- :shortcut.category/navigating
|
|
|
- [:editor/up
|
|
|
- :editor/down
|
|
|
- :editor/left
|
|
|
- :editor/right
|
|
|
- :editor/collapse-block-children
|
|
|
- :editor/expand-block-children
|
|
|
- :editor/toggle-open-blocks
|
|
|
- :go/backward
|
|
|
- :go/forward
|
|
|
- :go/home
|
|
|
- :go/journals
|
|
|
- :go/all-pages
|
|
|
- :go/graph-view
|
|
|
- :go/all-graphs
|
|
|
- :go/whiteboards
|
|
|
- :go/flashcards
|
|
|
- :go/tomorrow
|
|
|
- :go/next-journal
|
|
|
- :go/prev-journal
|
|
|
- :go/keyboard-shortcuts]
|
|
|
-
|
|
|
- :shortcut.category/block-editing
|
|
|
- [:editor/backspace
|
|
|
- :editor/delete
|
|
|
- :editor/indent
|
|
|
- :editor/outdent
|
|
|
- :editor/new-block
|
|
|
- :editor/new-line
|
|
|
- :editor/zoom-in
|
|
|
- :editor/zoom-out
|
|
|
- :editor/cycle-todo
|
|
|
- :editor/follow-link
|
|
|
- :editor/open-link-in-sidebar
|
|
|
- :editor/move-block-up
|
|
|
- :editor/move-block-down
|
|
|
- :editor/escape-editing
|
|
|
- :editor/add-property]
|
|
|
-
|
|
|
- :shortcut.category/block-command-editing
|
|
|
- [:editor/backspace
|
|
|
- :editor/clear-block
|
|
|
- :editor/kill-line-before
|
|
|
- :editor/kill-line-after
|
|
|
- :editor/beginning-of-block
|
|
|
- :editor/end-of-block
|
|
|
- :editor/forward-word
|
|
|
- :editor/backward-word
|
|
|
- :editor/forward-kill-word
|
|
|
- :editor/backward-kill-word
|
|
|
- :editor/replace-block-reference-at-point
|
|
|
- :editor/copy-embed
|
|
|
- :editor/paste-text-in-one-block-at-point
|
|
|
- :editor/select-up
|
|
|
- :editor/select-down]
|
|
|
-
|
|
|
- :shortcut.category/block-selection
|
|
|
- [:editor/open-edit
|
|
|
- :editor/select-all-blocks
|
|
|
- :editor/select-parent
|
|
|
- :editor/select-block-up
|
|
|
- :editor/select-block-down
|
|
|
- :editor/delete-selection]
|
|
|
-
|
|
|
- :shortcut.category/toggle
|
|
|
- [:ui/toggle-help
|
|
|
- :editor/toggle-open-blocks
|
|
|
- :editor/toggle-undo-redo-mode
|
|
|
- :editor/toggle-number-list
|
|
|
- :ui/toggle-wide-mode
|
|
|
- :ui/toggle-document-mode
|
|
|
- :ui/toggle-brackets
|
|
|
- :ui/toggle-theme
|
|
|
- :ui/toggle-left-sidebar
|
|
|
- :ui/toggle-right-sidebar
|
|
|
- :ui/toggle-settings
|
|
|
- :ui/toggle-contents
|
|
|
- :ui/cycle-color-off
|
|
|
- :ui/cycle-color]
|
|
|
-
|
|
|
- :shortcut.category/whiteboard
|
|
|
- [:editor/new-whiteboard
|
|
|
- :whiteboard/select
|
|
|
- :whiteboard/pan
|
|
|
- :whiteboard/portal
|
|
|
- :whiteboard/pencil
|
|
|
- :whiteboard/highlighter
|
|
|
- :whiteboard/eraser
|
|
|
- :whiteboard/connector
|
|
|
- :whiteboard/text
|
|
|
- :whiteboard/rectangle
|
|
|
- :whiteboard/ellipse
|
|
|
- :whiteboard/reset-zoom
|
|
|
- :whiteboard/zoom-to-fit
|
|
|
- :whiteboard/zoom-to-selection
|
|
|
- :whiteboard/zoom-out
|
|
|
- :whiteboard/zoom-in
|
|
|
- :whiteboard/send-backward
|
|
|
- :whiteboard/send-to-back
|
|
|
- :whiteboard/bring-forward
|
|
|
- :whiteboard/bring-to-front
|
|
|
- :whiteboard/lock
|
|
|
- :whiteboard/unlock
|
|
|
- :whiteboard/group
|
|
|
- :whiteboard/ungroup
|
|
|
- :whiteboard/toggle-grid
|
|
|
- :whiteboard/clone-left
|
|
|
- :whiteboard/clone-right
|
|
|
- :whiteboard/clone-top
|
|
|
- :whiteboard/clone-bottom]
|
|
|
-
|
|
|
- :shortcut.category/others
|
|
|
- [:pdf/previous-page
|
|
|
- :pdf/next-page
|
|
|
- :pdf/close
|
|
|
- :pdf/find
|
|
|
- :command/toggle-favorite
|
|
|
- :command/run
|
|
|
- :graph/export-as-html
|
|
|
- :graph/open
|
|
|
- :graph/remove
|
|
|
- :graph/add
|
|
|
- :graph/re-index
|
|
|
- :sidebar/close-top
|
|
|
- :sidebar/clear
|
|
|
- :sidebar/open-today-page
|
|
|
- :search/re-index
|
|
|
- :editor/insert-youtube-timestamp
|
|
|
- :editor/open-file-in-default-app
|
|
|
- :editor/open-file-in-directory
|
|
|
- :editor/copy-page-url
|
|
|
- :window/close
|
|
|
- :auto-complete/prev
|
|
|
- :auto-complete/next
|
|
|
- :auto-complete/complete
|
|
|
- :auto-complete/shift-complete
|
|
|
- :auto-complete/meta-complete
|
|
|
- :auto-complete/open-link
|
|
|
- :date-picker/prev-day
|
|
|
- :date-picker/next-day
|
|
|
- :date-picker/prev-week
|
|
|
- :date-picker/next-week
|
|
|
- :date-picker/complete
|
|
|
- :git/commit
|
|
|
- :dev/show-block-data
|
|
|
- :dev/show-block-ast
|
|
|
- :dev/show-page-data
|
|
|
- :dev/show-page-ast
|
|
|
- :dev/replace-graph-with-db-file
|
|
|
- :ui/clear-all-notifications]
|
|
|
-
|
|
|
- :shortcut.category/plugins
|
|
|
- []}))
|
|
|
+ {:shortcut.category/basics
|
|
|
+ [:go/search
|
|
|
+ :editor/new-block
|
|
|
+ :editor/new-line
|
|
|
+ :editor/indent
|
|
|
+ :editor/outdent
|
|
|
+ :editor/select-all-blocks
|
|
|
+ :editor/select-parent
|
|
|
+ :go/search-in-page
|
|
|
+ :command-palette/toggle
|
|
|
+ :go/electron-find-in-page
|
|
|
+ :go/electron-jump-to-the-next
|
|
|
+ :go/electron-jump-to-the-previous
|
|
|
+ :editor/undo
|
|
|
+ :editor/redo
|
|
|
+ :editor/copy
|
|
|
+ :editor/copy-text
|
|
|
+ :editor/cut]
|
|
|
+
|
|
|
+ :shortcut.category/formatting
|
|
|
+ [:editor/bold
|
|
|
+ :editor/insert-link
|
|
|
+ :editor/italics
|
|
|
+ :editor/strike-through
|
|
|
+ :editor/highlight]
|
|
|
+
|
|
|
+ :shortcut.category/navigating
|
|
|
+ [:editor/up
|
|
|
+ :editor/down
|
|
|
+ :editor/left
|
|
|
+ :editor/right
|
|
|
+ :editor/collapse-block-children
|
|
|
+ :editor/expand-block-children
|
|
|
+ :editor/toggle-open-blocks
|
|
|
+ :go/backward
|
|
|
+ :go/forward
|
|
|
+ :go/home
|
|
|
+ :go/journals
|
|
|
+ :go/all-pages
|
|
|
+ :go/graph-view
|
|
|
+ :go/all-graphs
|
|
|
+ :go/whiteboards
|
|
|
+ :go/flashcards
|
|
|
+ :go/tomorrow
|
|
|
+ :go/next-journal
|
|
|
+ :go/prev-journal
|
|
|
+ :go/keyboard-shortcuts]
|
|
|
+
|
|
|
+ :shortcut.category/block-editing
|
|
|
+ [:editor/backspace
|
|
|
+ :editor/delete
|
|
|
+ :editor/indent
|
|
|
+ :editor/outdent
|
|
|
+ :editor/new-block
|
|
|
+ :editor/new-line
|
|
|
+ :editor/zoom-in
|
|
|
+ :editor/zoom-out
|
|
|
+ :editor/cycle-todo
|
|
|
+ :editor/follow-link
|
|
|
+ :editor/open-link-in-sidebar
|
|
|
+ :editor/move-block-up
|
|
|
+ :editor/move-block-down
|
|
|
+ :editor/escape-editing]
|
|
|
+
|
|
|
+ :shortcut.category/block-command-editing
|
|
|
+ [:editor/backspace
|
|
|
+ :editor/clear-block
|
|
|
+ :editor/kill-line-before
|
|
|
+ :editor/kill-line-after
|
|
|
+ :editor/beginning-of-block
|
|
|
+ :editor/end-of-block
|
|
|
+ :editor/forward-word
|
|
|
+ :editor/backward-word
|
|
|
+ :editor/forward-kill-word
|
|
|
+ :editor/backward-kill-word
|
|
|
+ :editor/replace-block-reference-at-point
|
|
|
+ :editor/copy-embed
|
|
|
+ :editor/paste-text-in-one-block-at-point
|
|
|
+ :editor/select-up
|
|
|
+ :editor/select-down]
|
|
|
+
|
|
|
+ :shortcut.category/block-selection
|
|
|
+ [:editor/open-edit
|
|
|
+ :editor/select-all-blocks
|
|
|
+ :editor/select-parent
|
|
|
+ :editor/select-block-up
|
|
|
+ :editor/select-block-down
|
|
|
+ :editor/delete-selection]
|
|
|
+
|
|
|
+ :shortcut.category/toggle
|
|
|
+ [:ui/toggle-help
|
|
|
+ :editor/toggle-open-blocks
|
|
|
+ :editor/toggle-undo-redo-mode
|
|
|
+ :editor/toggle-number-list
|
|
|
+ :ui/toggle-wide-mode
|
|
|
+ :ui/toggle-document-mode
|
|
|
+ :ui/toggle-brackets
|
|
|
+ :ui/toggle-theme
|
|
|
+ :ui/toggle-left-sidebar
|
|
|
+ :ui/toggle-right-sidebar
|
|
|
+ :ui/toggle-settings
|
|
|
+ :ui/toggle-contents
|
|
|
+ :ui/accent-color-reset
|
|
|
+ :ui/accent-colors-picker]
|
|
|
+
|
|
|
+ :shortcut.category/whiteboard
|
|
|
+ [:editor/new-whiteboard
|
|
|
+ :whiteboard/select
|
|
|
+ :whiteboard/pan
|
|
|
+ :whiteboard/portal
|
|
|
+ :whiteboard/pencil
|
|
|
+ :whiteboard/highlighter
|
|
|
+ :whiteboard/eraser
|
|
|
+ :whiteboard/connector
|
|
|
+ :whiteboard/text
|
|
|
+ :whiteboard/rectangle
|
|
|
+ :whiteboard/ellipse
|
|
|
+ :whiteboard/reset-zoom
|
|
|
+ :whiteboard/zoom-to-fit
|
|
|
+ :whiteboard/zoom-to-selection
|
|
|
+ :whiteboard/zoom-out
|
|
|
+ :whiteboard/zoom-in
|
|
|
+ :whiteboard/send-backward
|
|
|
+ :whiteboard/send-to-back
|
|
|
+ :whiteboard/bring-forward
|
|
|
+ :whiteboard/bring-to-front
|
|
|
+ :whiteboard/lock
|
|
|
+ :whiteboard/unlock
|
|
|
+ :whiteboard/group
|
|
|
+ :whiteboard/ungroup
|
|
|
+ :whiteboard/toggle-grid
|
|
|
+ :whiteboard/clone-left
|
|
|
+ :whiteboard/clone-right
|
|
|
+ :whiteboard/clone-top
|
|
|
+ :whiteboard/clone-bottom]
|
|
|
+
|
|
|
+ :shortcut.category/others
|
|
|
+ [:pdf/previous-page
|
|
|
+ :pdf/next-page
|
|
|
+ :pdf/close
|
|
|
+ :pdf/find
|
|
|
+ :command/toggle-favorite
|
|
|
+ :command/run
|
|
|
+ :graph/export-as-html
|
|
|
+ :graph/open
|
|
|
+ :graph/remove
|
|
|
+ :graph/add
|
|
|
+ :graph/save
|
|
|
+ :graph/re-index
|
|
|
+ :sidebar/close-top
|
|
|
+ :sidebar/clear
|
|
|
+ :sidebar/open-today-page
|
|
|
+ :search/re-index
|
|
|
+ :editor/insert-youtube-timestamp
|
|
|
+ :editor/open-file-in-default-app
|
|
|
+ :editor/open-file-in-directory
|
|
|
+ :editor/copy-page-url
|
|
|
+ :window/close
|
|
|
+ :auto-complete/prev
|
|
|
+ :auto-complete/next
|
|
|
+ :auto-complete/complete
|
|
|
+ :auto-complete/shift-complete
|
|
|
+ :auto-complete/open-link
|
|
|
+ :date-picker/prev-day
|
|
|
+ :date-picker/next-day
|
|
|
+ :date-picker/prev-week
|
|
|
+ :date-picker/next-week
|
|
|
+ :date-picker/complete
|
|
|
+ :git/commit
|
|
|
+ :dev/show-block-data
|
|
|
+ :dev/show-block-ast
|
|
|
+ :dev/show-page-data
|
|
|
+ :dev/show-page-ast
|
|
|
+ :ui/clear-all-notifications]
|
|
|
+
|
|
|
+ :shortcut.category/plugins
|
|
|
+ []}))
|
|
|
|
|
|
(let [category-maps {::category (set (keys @*category))
|
|
|
::dicts/category dicts/categories}]
|
|
|
(assert (= (::category category-maps) (::dicts/category category-maps))
|
|
|
- (str "Keys for category maps must have an english label "
|
|
|
- (data/diff (::category category-maps) (::dicts/category category-maps)))))
|
|
|
+ (str "Keys for category maps must have an english label "
|
|
|
+ (data/diff (::category category-maps) (::dicts/category category-maps)))))
|
|
|
|
|
|
(defn get-category-shortcuts
|
|
|
"Active list of categories for docs purpose"
|
|
@@ -987,9 +948,9 @@
|
|
|
(swap! *shortcut-cmds assoc id (:cmd shortcut-map))
|
|
|
(let [plugin? (str/starts-with? (str id) ":plugin.")
|
|
|
category (or (:category shortcut-map)
|
|
|
- (if plugin?
|
|
|
- :shortcut.category/plugins
|
|
|
- :shortcut.category/others))]
|
|
|
+ (if plugin?
|
|
|
+ :shortcut.category/plugins
|
|
|
+ :shortcut.category/others))]
|
|
|
(swap! *category update category #(conj % id))))))
|
|
|
|
|
|
(defn remove-shortcut!
|