Skip to content

Commit

Permalink
fix(plugin): repeat registration key to plugin ui items
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 authored and tiensonqin committed Jun 20, 2022
1 parent fe1419a commit 5b14b6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/frontend/components/plugins.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@
(when-let [^js el (rum/deref *el)]
(js/LSPlugin.pluginHelpers.setupInjectedUI.call
pl #js {:slot (.-id el) :key key :template template} #js {})))
[])
[template])

(if-not (nil? pl)
[:div
Expand Down
8 changes: 5 additions & 3 deletions src/main/frontend/handler/plugin.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,13 @@
(swap! state/state medley/dissoc-in [:plugin/simple-commands (keyword pid)]))

(defn register-plugin-ui-item
[pid {:keys [type] :as opts}]
[pid {:keys [key type] :as opts}]
(when-let [pid (keyword pid)]
(when (contains? (:plugin/installed-plugins @state/state) pid)
(swap! state/state update-in [:plugin/installed-ui-items pid]
(fnil conj []) [type opts pid])
(let [items (or (get-in @state/state [:plugin/installed-ui-items pid]) [])
items (filter #(not= key (:key (second %))) items)]
(swap! state/state assoc-in [:plugin/installed-ui-items pid]
(conj items [type opts pid])))
true)))

(defn unregister-plugin-ui-items
Expand Down

0 comments on commit 5b14b6f

Please sign in to comment.