mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🐛 Fix problem with plugins on system theme
This commit is contained in:
parent
daf3b5caa8
commit
e6a7eed7a9
2 changed files with 25 additions and 4 deletions
|
@ -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")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue