mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 18:36:43 +00:00
Install and uninstall plugins from file
Change plugins.edn to key off id as it is unique and all operations work off of it. Note: there are still some bugs with certain plugin installs
This commit is contained in:
@@ -225,7 +225,7 @@
|
||||
:on-confirm (fn [_ {:keys [close-fn]}]
|
||||
(close-fn)
|
||||
(plugin-handler/unregister-plugin id)
|
||||
(plugin-config/remove-plugin name))})]
|
||||
(plugin-config/remove-plugin id))})]
|
||||
(state/set-sub-modal! confirm-fn {:center? true}))}
|
||||
(t :plugin/uninstall)]]]
|
||||
|
||||
@@ -547,6 +547,9 @@
|
||||
[{:title [:span.flex.items-center (ui/icon "world") (t :settings-page/network-proxy)]
|
||||
:options {:on-click #(state/pub-event! [:go/proxy-settings agent-opts])}}]
|
||||
|
||||
[{:title [:span.flex.items-center (ui/icon "arrow-down-circle") (t :plugin/install-from-file)]
|
||||
:options {:on-click plugin-config/open-sync-modal}}]
|
||||
|
||||
(when (state/developer-mode?)
|
||||
[{:hr true}
|
||||
{:title [:span.flex.items-center (ui/icon "file-code") "Open Preferences"]
|
||||
@@ -796,6 +799,36 @@
|
||||
(and (seq unchecked)
|
||||
(= (count unchecked) (count updates)))))])]))
|
||||
|
||||
(rum/defc plugins-from-file
|
||||
< rum/reactive
|
||||
[plugins]
|
||||
[:div.cp__plugins-fom-file
|
||||
[:h1.mb-4.text-2xl.p-1 "Install plugins from plugins.edn"]
|
||||
(if (seq plugins)
|
||||
[:div
|
||||
[:div.mb-2.text-xl (util/format "The following %s plugin(s) will replace your %s plugin(s):"
|
||||
(count (:install plugins))
|
||||
(count (:uninstall plugins)))]
|
||||
;; lists
|
||||
[:ul
|
||||
(for [it (:install plugins)
|
||||
:let [k (str "lsp-it-" (name (:id it)))]]
|
||||
[:li.flex.items-center
|
||||
{:key k}
|
||||
[:label.flex-1
|
||||
{:for k}
|
||||
[:strong.px-3 (str (:name it) " " (:version it))]]])]
|
||||
|
||||
;; actions
|
||||
[:div.pt-5
|
||||
(ui/button [:span "Install"]
|
||||
:on-click #(do
|
||||
(plugin-config/update-plugins plugins)
|
||||
(state/close-sub-modal! "ls-plugins-from-file-modal")))]]
|
||||
;; all done
|
||||
[:div.py-4 [:strong.text-xl "\uD83C\uDF89 All synced!"]])])
|
||||
|
||||
|
||||
(defn open-select-theme!
|
||||
[]
|
||||
(state/set-sub-modal! installed-themes))
|
||||
@@ -1041,6 +1074,14 @@
|
||||
(waiting-coming-updates))
|
||||
{:center? true}))
|
||||
|
||||
(defn open-plugins-from-file-modal!
|
||||
[plugins]
|
||||
(state/set-sub-modal!
|
||||
(fn [_close!]
|
||||
(plugins-from-file plugins))
|
||||
{:center? true
|
||||
:id "ls-plugins-from-file-modal"}))
|
||||
|
||||
(defn open-focused-settings-modal!
|
||||
[title]
|
||||
(state/set-sub-modal!
|
||||
|
||||
Reference in New Issue
Block a user