mirror of
https://github.com/logseq/logseq.git
synced 2026-04-26 07:05:10 +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:
@@ -25,12 +25,13 @@
|
||||
(defn- normalize-keyword-for-json
|
||||
[input]
|
||||
(when input
|
||||
(walk/postwalk
|
||||
(fn [a]
|
||||
(cond
|
||||
(keyword? a) (csk/->camelCase (name a))
|
||||
(uuid? a) (str a)
|
||||
:else a)) input)))
|
||||
(let [f (fn [[k v]] (if (keyword? k) [(csk/->camelCase (name k)) v] [k v]))]
|
||||
(walk/postwalk
|
||||
(fn [x]
|
||||
(cond
|
||||
(map? x) (into {} (map f x))
|
||||
(uuid? x) (str x)
|
||||
:else x)) input))))
|
||||
|
||||
(defn invoke-exported-api
|
||||
[type & args]
|
||||
@@ -297,7 +298,8 @@
|
||||
[pid key keybinding]
|
||||
(let [id (keyword (str "plugin." pid "/" key))
|
||||
binding (:binding keybinding)
|
||||
binding (some->> (if (string? binding) [binding] (seq binding))
|
||||
binding (some->> (if (string? binding) [binding] (vec binding))
|
||||
(remove string/blank?)
|
||||
(map shortcut-utils/undecorate-binding))
|
||||
binding (if util/mac?
|
||||
(or (:mac keybinding) binding) binding)
|
||||
@@ -495,7 +497,7 @@
|
||||
payload)
|
||||
(if (keyword? plugin-id) (name plugin-id) plugin-id))
|
||||
(catch :default e
|
||||
(js/console.error "[Hook Plugin Err]" e)))))
|
||||
(log/error :invoke-hook-exception e)))))
|
||||
|
||||
(defn hook-plugin-app
|
||||
([type payload] (hook-plugin-app type payload nil))
|
||||
|
||||
Reference in New Issue
Block a user