mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Merge pull request #6793 from penpot/alotor-fix-plugins-system-theme
Some checks are pending
Commit Message Check / Check Commit Message (push) Waiting to run
Some checks are pending
Commit Message Check / Check Commit Message (push) Waiting to run
🐛 Fix problem with plugins on system theme
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
[app.plugins.viewport :as viewport]
|
[app.plugins.viewport :as viewport]
|
||||||
[app.util.code-gen :as cg]
|
[app.util.code-gen :as cg]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
|
[app.util.theme :as theme]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
[cuerdas.core :as str]))
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
@@ -216,9 +217,15 @@
|
|||||||
:getTheme
|
:getTheme
|
||||||
(fn []
|
(fn []
|
||||||
(let [theme (get-in @st/state [:profile :theme])]
|
(let [theme (get-in @st/state [:profile :theme])]
|
||||||
(if (or (not theme) (= theme "default"))
|
(cond
|
||||||
|
(or (not theme) (= theme "system"))
|
||||||
|
(theme/get-system-theme)
|
||||||
|
|
||||||
|
(= theme "default")
|
||||||
"dark"
|
"dark"
|
||||||
(get-in @st/state [:profile :theme]))))
|
|
||||||
|
:else
|
||||||
|
theme)))
|
||||||
|
|
||||||
:getCurrentUser
|
:getCurrentUser
|
||||||
(fn []
|
(fn []
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
[app.plugins.parser :as parser]
|
[app.plugins.parser :as parser]
|
||||||
[app.plugins.shape :as shape]
|
[app.plugins.shape :as shape]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
|
[app.util.theme :as theme]
|
||||||
[goog.functions :as gf]))
|
[goog.functions :as gf]))
|
||||||
|
|
||||||
(defmulti handle-state-change (fn [type _] type))
|
(defmulti handle-state-change (fn [type _] type))
|
||||||
@@ -50,10 +51,23 @@
|
|||||||
::not-changed
|
::not-changed
|
||||||
(apply array (map str new-selection)))))
|
(apply array (map str new-selection)))))
|
||||||
|
|
||||||
|
(defn- get-theme
|
||||||
|
[state]
|
||||||
|
(let [theme (get-in state [:profile :theme])]
|
||||||
|
(cond
|
||||||
|
(or (not theme) (= theme "system"))
|
||||||
|
(theme/get-system-theme)
|
||||||
|
|
||||||
|
(= theme "default")
|
||||||
|
"dark"
|
||||||
|
|
||||||
|
:else
|
||||||
|
theme)))
|
||||||
|
|
||||||
(defmethod handle-state-change "themechange"
|
(defmethod handle-state-change "themechange"
|
||||||
[_ _ old-val new-val _]
|
[_ _ old-val new-val _]
|
||||||
(let [old-theme (get-in old-val [:profile :theme])
|
(let [old-theme (get-theme old-val)
|
||||||
new-theme (get-in new-val [:profile :theme])]
|
new-theme (get-theme new-val)]
|
||||||
(if (identical? old-theme new-theme)
|
(if (identical? old-theme new-theme)
|
||||||
::not-changed
|
::not-changed
|
||||||
(if (= new-theme "default")
|
(if (= new-theme "default")
|
||||||
|
|||||||
Reference in New Issue
Block a user