fix(plugin): invalid custom theme link href

This commit is contained in:
charlie
2025-05-08 15:22:26 +08:00
parent 8d90d8b909
commit 7f2eb16ad5
2 changed files with 11 additions and 3 deletions

View File

@@ -53,6 +53,13 @@
(defonce stats-url (str central-endpoint "stats.json"))
(declare select-a-plugin-theme)
(defn assets-theme-to-file
[theme]
(when theme
(cond-> theme
(util/electron?)
(update :url #(some-> % (string/replace-first "assets://" "file://"))))))
(defn load-plugin-preferences
[]
(-> (invoke-exported-api "load_user_preferences")
@@ -416,7 +423,7 @@
(defn select-a-plugin-theme
[pid]
(when-let [themes (get (group-by :pid (:plugin/installed-themes @state/state)) pid)]
(when-let [theme (first themes)]
(when-let [theme (assets-theme-to-file (first themes))]
(js/LSPluginCore.selectTheme (bean/->js theme)))))
(defn update-plugin-settings-state
@@ -741,6 +748,7 @@
(.on "theme-selected" (fn [^js theme]
(let [theme (bean/->clj theme)
theme (assets-theme-to-file theme)
url (:url theme)
mode (:mode theme)]
(when mode