mirror of
https://github.com/penpot/penpot.git
synced 2025-07-06 04:07:19 +02:00
🐛 Fix incorrect handling of selected token set
This commit is contained in:
parent
b0a6e5c946
commit
a029ec18a6
2 changed files with 32 additions and 25 deletions
|
@ -31,6 +31,8 @@
|
|||
;; TOKENS Getters
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; FIXME: lookup rename
|
||||
|
||||
(defn get-tokens-lib
|
||||
[state]
|
||||
(-> (dsh/lookup-file-data state)
|
||||
|
@ -238,12 +240,17 @@
|
|||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(let [data (dsh/lookup-file-data state)
|
||||
token-set (dwts/get-selected-token-set state)
|
||||
selected (dm/get-in state [:workspace-tokens :selected-token-set-name])
|
||||
|
||||
tokens-lib (get-tokens-lib state)
|
||||
token-set (if selected
|
||||
(some-> tokens-lib (ctob/get-set selected))
|
||||
(some-> tokens-lib (ctob/get-sets) (first)))
|
||||
|
||||
set-name (or (:name token-set) "Global")
|
||||
changes (if (not token-set)
|
||||
;; No set created add a global set
|
||||
(let [tokens-lib (get-tokens-lib state)
|
||||
token-set (ctob/make-token-set :name set-name :tokens {(:name token) token})
|
||||
(let [token-set (ctob/make-token-set :name set-name :tokens {(:name token) token})
|
||||
hidden-theme (ctob/make-hidden-token-theme :sets [set-name])
|
||||
active-theme-paths (some-> tokens-lib ctob/get-active-theme-paths)
|
||||
add-to-hidden-theme? (= active-theme-paths #{ctob/hidden-token-theme-path})
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
[app.main.data.helpers :as dsh]))
|
||||
|
||||
(defn get-selected-token-set-name [state]
|
||||
(or (get-in state [:workspace-local :selected-token-set-name])
|
||||
(or (get-in state [:workspace-tokens :selected-token-set-name])
|
||||
(some-> (dsh/lookup-file-data state)
|
||||
(get :tokens-lib)
|
||||
(ctob/get-sets)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue