mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 18:06:32 +00:00
Enhance: plugin APIs (#10399)
* enhance(plugin): call apis with the sdk ns * enhance(plugin): types * enhance(api): get value from the computed style * enhance(api): types * enhance(plugin): types * enhance(plugin): types * fix: lint * fix(apis): incorrect shortcut command registion for block editing mode #10392 * fix(api): types * enhance(apis): support register shortcuts with multi binding vals * fix(plugins): normalize command key to make the internal keyword legal * chore(plugin): build libs core * chore(plugin): bump version * enhance(apis): normalize apis cljs data * chore(plugin): update libs user sdk * chore(plugin): CHANGELOG.md * fix: typo * fix(ux): support querying plugins with right space chars
This commit is contained in:
@@ -925,15 +925,17 @@
|
||||
(def *shortcut-cmds (atom {}))
|
||||
|
||||
(defn add-shortcut!
|
||||
[handler-id id shortcut-map]
|
||||
(swap! *config assoc-in [handler-id id] shortcut-map)
|
||||
(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))]
|
||||
(swap! *category update category #(conj % id))))
|
||||
([handler-id id shortcut-map] (add-shortcut! handler-id id shortcut-map false))
|
||||
([handler-id id shortcut-map config-only?]
|
||||
(swap! *config assoc-in [handler-id id] shortcut-map)
|
||||
(when-not config-only?
|
||||
(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))]
|
||||
(swap! *category update category #(conj % id))))))
|
||||
|
||||
(defn remove-shortcut!
|
||||
[handler-id id]
|
||||
|
||||
Reference in New Issue
Block a user