Add a command to switch graphs (#4009)

* First pass at select-graph with select component

* Add empty placeholder and move graph switch logic to events

* Remove unused force? in shortcuts

* Document additional option and make disabled open-select consistent

* Address review feedback

Add data check to :graph/switch, translation improvements and update
browser to display graph names same as in the sidebar

Co-authored-by: Tienson Qin <tiensonqin@gmail.com>
This commit is contained in:
Gabriel Horner
2022-01-24 21:24:14 -05:00
committed by GitHub
parent ca755f2605
commit ec513a54d2
12 changed files with 192 additions and 74 deletions

View File

@@ -182,13 +182,11 @@
:editor/up {:desc "Move cursor up / Select up"
:binding "up"
:fn (editor-handler/shortcut-up-down :up)
:force? true}
:fn (editor-handler/shortcut-up-down :up)}
:editor/down {:desc "Move cursor down / Select down"
:binding "down"
:fn (editor-handler/shortcut-up-down :down)
:force? true}
:fn (editor-handler/shortcut-up-down :down)}
:editor/left {:desc "Move cursor left / Open selected block at beginning"
:binding "left"
@@ -225,13 +223,11 @@
:editor/expand-block-children {:desc "Expand"
:binding "mod+down"
:fn editor-handler/expand!
:force? true}
:fn editor-handler/expand!}
:editor/collapse-block-children {:desc "Collapse"
:binding "mod+up"
:fn editor-handler/collapse!
:force? true}
:fn editor-handler/collapse!}
:editor/indent {:desc "Indent block"
:binding "tab"
@@ -316,8 +312,11 @@
:command-palette/toggle {:desc "Toggle command palette"
:binding "mod+shift+p"
:fn (fn [] (state/toggle! :ui/command-palette-open?))
:force? true}
:fn (fn [] (state/toggle! :ui/command-palette-open?))}
:select-graph/open {:desc "Open select graph component"
:fn (fn [] (state/set-state! :ui/open-select :select-graph))
:binding "mod+shift+g"}
:command/run (when (util/electron?)
{:desc "Run git command"
@@ -432,7 +431,7 @@
:ui/toggle-cards {:desc "Toggle cards"
:binding "t c"
:fn ui-handler/toggle-cards!}
;; :ui/toggle-between-page-and-file route-handler/toggle-between-page-and-file!
;; :ui/toggle-between-page-and-file route-handler/toggle-between-page-and-file!
:git/commit {:desc "Git commit message"
:binding "c"
@@ -499,6 +498,7 @@
:shortcut.handler/editor-global
(->
(build-category-map [:command-palette/toggle
:select-graph/open
:editor/cycle-todo
:editor/up
:editor/down
@@ -680,6 +680,7 @@
:pdf/next-page
:command/run
:command-palette/toggle
:select-graph/open
:sidebar/clear
:sidebar/open-today-page
:search/re-index