mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 19:06:21 +00:00
Enhance/shortcuts (#9803)
* refactor(shortcuts): simplify to build handler category map * fix(shortcuts): redundant re-mount for the pdf shortcuts * refactor(shortcuts): simplify names * refactor(shortcuts): simplify user keynames * fix(shortcuts): persist inited state for dev mode * refactor(shortcuts): simplify handlers installation * refactor(shortcuts): optimize shortcuts mixin * fix: incorrect function ref * refactor(shortcuts): shortcuts mixin * fix(shortcuts): incorrect initialization for the pdf shortcut handler * refactor(shortcuts): optimize binding keys map * refactor(shortcuts): optimize shortcuts conflicts detection * refactor(shortcuts): optimize binding ids map * refactor(shortcuts): WIP the new keymap page * refactor(shortcuts): WIP the new keymap related components * feat(shortcuts): WIP fuzzy search for the shortcuts * refactor(shortcuts): WIP the new keymap related components * feat(shortcuts): WIP the new shorcuts record component * feat(shortcuts): WIP the new shorcuts record component * feat(shortcuts): WIP check shortcut conflicts component * feat(shortcuts): WIP the new shorcuts record component * refactor(shortcuts): WIP persist user shortcuts * fix(shortcuts): detection for the conflicts * feat(shortcuts): WIP detection for the conflicts * feat(shortcuts): WIP persist user shortcuts * refactor(shortcuts): add unit tests * enhance(ux): search pane for the shortcuts * feat(shortcuts): remove the existent shortcut item * feat(shortcuts): fold/unfold categories * feat(shortcuts): add shortcuts filters * enhance(shortcuts): resove binding map description * enhance(shortcuts): reactive category shortcuts * enhance(shortcuts): register api for plugins * feat(shortcuts): add keyboard shortcuts filters * feat(shortcuts): impl keyboard shortcuts filters * enhance(shortcuts): leader keys for the shortcut conflicts detection * enhance(tests): leader keys conflicts for the shortucts * enhance(shortcuts): parse conflicts from current binding list * enhance(ui): polish the component of the restore shortcut action * enhance(shortcuts): get conflicts with specific handler id * enhance(shortcuts): polish the confilts component * enhance(shortcuts): polish keymap conflicts component * enhance(shortcuts): ux for handling shorcuts conflicts * enhance(ui): polish notifications cp * fix(shortcuts): remove reduplicate shortcuts for category * enhance(shortcuts): polish ux for handling shorcuts conflicts * chore(plugin): build libs core * enhance(plugin): support shortcut command lifecycle hooks * enhance(plugin): support shortcut command lifecycle hooks * chore(plugin): build libs core * enhance(shortcuts): support shortcuts saved to global config * enhance(shortcuts): support shortcuts be saved to global config * feat(shortcuts): support keymap manager to global settings * enhance(shortcuts): shortcut to open keymap settings * fix(units): tests * fix: lints * enhance(shortcuts): unlisten all shortcuts * fix: lints * fix: lints * fix(units): tests * fix(units): tests * fix(units): tests * enhance(shortcuts): unlisten/listen all shortcuts * enhance(shortcuts): polish conflicts component * fix(ui): modal size * fix(ui): modal panel container * enhance(shortcuts): i18n * enhance(ui): layout of the shortcuts recorder component * fix(lint): i18n * enhance(ui): keyboard icon for the keymap settings tab * fix(shortcuts): incorrect filters for the collaspsed shortcuts * enhance(ui): polish details for the keymap settings * enhance(ui): polish details for the keymap settings * fix(shortcuts): get shortcut description error when the associated handler-id not exist * fix(ui): the shortcut disabled label overlaps with section headers. * refactor(shortcuts): names * enhance(ui): filter icons
This commit is contained in:
@@ -25,9 +25,9 @@
|
||||
(deftest test-memoize-last
|
||||
(testing "memoize-last add test"
|
||||
(let [actual-ops (atom 0)
|
||||
m+ (util/memoize-last (fn [x1 x2]
|
||||
(swap! actual-ops inc) ;; side effect for counting
|
||||
(+ x1 x2)))]
|
||||
m+ (util/memoize-last (fn [x1 x2]
|
||||
(swap! actual-ops inc) ;; side effect for counting
|
||||
(+ x1 x2)))]
|
||||
(is (= (m+ 1 1) 2))
|
||||
(is (= @actual-ops 1))
|
||||
(is (= (m+ 1 1) 2))
|
||||
@@ -44,58 +44,58 @@
|
||||
|
||||
(testing "memoize-last nested mapping test"
|
||||
(let [actual-ops (atom 0)
|
||||
flatten-f (util/memoize-last (fn [& args]
|
||||
(swap! actual-ops inc) ;; side effect for counting
|
||||
(apply #'shortcut-data-helper/flatten-key-bindings args)))
|
||||
target (atom {:part1 {:date-picker/complete {:binding "enter"
|
||||
:fn "ui-handler/shortcut-complete"}
|
||||
:date-picker/prev-day {:binding "left"
|
||||
:fn "ui-handler/shortcut-prev-day"}}
|
||||
:part2 {:date-picker/next-day {:binding "right"
|
||||
:fn "ui-handler/shortcut-next-day"}
|
||||
:date-picker/prev-week {:binding ["up" "ctrl+p"]
|
||||
:fn "ui-handler/shortcut-prev-week"}}})]
|
||||
(is (= (flatten-f (vals @target)) {:date-picker/complete "enter"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
flatten-f (util/memoize-last (fn [& args]
|
||||
(swap! actual-ops inc) ;; side effect for counting
|
||||
(apply #'shortcut-data-helper/flatten-bindings-by-id (conj (vec args) nil true))))
|
||||
target (atom {:part1 {:date-picker/complete {:binding "enter"
|
||||
:fn "ui-handler/shortcut-complete"}
|
||||
:date-picker/prev-day {:binding "left"
|
||||
:fn "ui-handler/shortcut-prev-day"}}
|
||||
:part2 {:date-picker/next-day {:binding "right"
|
||||
:fn "ui-handler/shortcut-next-day"}
|
||||
:date-picker/prev-week {:binding ["up" "ctrl+p"]
|
||||
:fn "ui-handler/shortcut-prev-week"}}})]
|
||||
(is (= (flatten-f @target) {:date-picker/complete "enter"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= @actual-ops 1))
|
||||
(is (= (flatten-f (vals @target)) {:date-picker/complete "enter"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= (flatten-f @target) {:date-picker/complete "enter"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= @actual-ops 1))
|
||||
;; edit value
|
||||
(swap! target assoc-in [:part1 :date-picker/complete :binding] "tab")
|
||||
(is (= (flatten-f (vals @target)) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= (flatten-f @target) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= @actual-ops 2))
|
||||
(is (= (flatten-f (vals @target)) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= (flatten-f @target) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= @actual-ops 2))
|
||||
(is (= (flatten-f (vals @target)) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= (flatten-f @target) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]}))
|
||||
(is (= @actual-ops 2))
|
||||
;; edit key
|
||||
(swap! target assoc :part3 {:date-picker/next-week {:binding "down"
|
||||
:fn "ui-handler/shortcut-next-week"}})
|
||||
(is (= (flatten-f (vals @target)) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]
|
||||
:date-picker/next-week "down"}))
|
||||
(is (= (flatten-f @target) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]
|
||||
:date-picker/next-week "down"}))
|
||||
(is (= @actual-ops 3))
|
||||
(is (= (flatten-f (vals @target)) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]
|
||||
:date-picker/next-week "down"}))
|
||||
(is (= (flatten-f @target) {:date-picker/complete "tab"
|
||||
:date-picker/prev-day "left"
|
||||
:date-picker/next-day "right"
|
||||
:date-picker/prev-week ["up" "ctrl+p"]
|
||||
:date-picker/next-week "down"}))
|
||||
(is (= @actual-ops 3)))))
|
||||
|
||||
(deftest test-media-format-from-input
|
||||
|
||||
Reference in New Issue
Block a user