diff --git a/src/main/frontend/components/shortcut.cljs b/src/main/frontend/components/shortcut.cljs index d7b1c844ff..ba39f8f50f 100644 --- a/src/main/frontend/components/shortcut.cljs +++ b/src/main/frontend/components/shortcut.cljs @@ -72,26 +72,28 @@ (customize-shortcut-dialog k action-name displayed-binding) {:center? true})))]))) -(rum/defc shortcut-table < rum/reactive - ([name] - (shortcut-table name false)) - ([name configurable?] - (let [shortcut-config (rum/cursor-in - state/state - [:config (state/get-current-repo) :shortcuts]) - _ (rum/react shortcut-config)] - [:div - [:table - [:thead - [:tr - [:th.text-left [:b (t name)]] - [:th.text-right]]] - [:tbody - (map (fn [[k {:keys [binding]}]] - [:tr {:key (str k)} - [:td.text-left (t (dh/decorate-namespace k))] - (shortcut-col k binding configurable? (t (dh/decorate-namespace k)))]) - (dh/binding-by-category name))]]]))) +(rum/defcs shortcut-table + < rum/reactive + (rum/local true ::folded?) + [state name configurable?] + (let [*folded? (::folded? state) + _ (state/sub [:config (state/get-current-repo) :shortcuts])] + [:div.cp__shortcut-table-wrap + [:a.fold + {:on-click #(reset! *folded? (not @*folded?))} + (ui/icon (if @*folded? "chevron-left" "chevron-down"))] + [:table + [:thead + [:tr + [:th.text-left [:b (t name)]] + [:th.text-right]]] + (when-not @*folded? + [:tbody + (map (fn [[k {:keys [binding]}]] + [:tr {:key (str k)} + [:td.text-left (t (dh/decorate-namespace k))] + (shortcut-col k binding configurable? (t (dh/decorate-namespace k)))]) + (dh/binding-by-category name))])]])) (rum/defc trigger-table [] [:table @@ -187,6 +189,7 @@ (shortcut-table :shortcut.category/formatting true) (shortcut-table :shortcut.category/toggle true) (when (state/enable-whiteboards?) (shortcut-table :shortcut.category/whiteboard true)) + (shortcut-table :shortcut.category/plugins true) (shortcut-table :shortcut.category/others true)]) (rum/defc keymap-pane diff --git a/src/main/frontend/components/shortcut.css b/src/main/frontend/components/shortcut.css index 5e942abc3d..1d6f43892e 100644 --- a/src/main/frontend/components/shortcut.css +++ b/src/main/frontend/components/shortcut.css @@ -10,4 +10,15 @@ } } } +} + +.cp__shortcut { + &-table-wrap { + @apply relative; + + a.fold { + @apply absolute right-0 top-0 w-full pt-3 pr-3 + flex items-center justify-end select-none; + } + } } \ No newline at end of file diff --git a/src/main/frontend/modules/shortcut/config.cljs b/src/main/frontend/modules/shortcut/config.cljs index c862030e2f..3e1681f894 100644 --- a/src/main/frontend/modules/shortcut/config.cljs +++ b/src/main/frontend/modules/shortcut/config.cljs @@ -926,7 +926,10 @@ :dev/show-block-ast :dev/show-page-data :dev/show-page-ast - :ui/clear-all-notifications]}) + :ui/clear-all-notifications] + + :shortcut.category/plugins + []}) (let [category-maps {::category (set (keys category*)) ::dicts/category (set (keys dicts/category))}] diff --git a/src/main/frontend/modules/shortcut/dicts.cljc b/src/main/frontend/modules/shortcut/dicts.cljc index 5ebbd48586..ca57400f68 100644 --- a/src/main/frontend/modules/shortcut/dicts.cljc +++ b/src/main/frontend/modules/shortcut/dicts.cljc @@ -171,6 +171,7 @@ :shortcut.category/block-selection "Block selection (press Esc to quit selection)" :shortcut.category/toggle "Toggle" :shortcut.category/whiteboard "Whiteboard" + :shortcut.category/plugins "Plugins" :shortcut.category/others "Others"}) (def ^:large-vars/data-var dicts