mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 23:56:41 +02:00
🐛 Fix incorrect key setup on color selection menu
This commit is contained in:
parent
889902080b
commit
c504e38f6d
1 changed files with 2 additions and 14 deletions
|
@ -8,9 +8,7 @@
|
||||||
(:require-macros [app.main.style :as stl])
|
(:require-macros [app.main.style :as stl])
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
|
||||||
[app.common.types.color :as ctc]
|
[app.common.types.color :as ctc]
|
||||||
[app.common.uuid :as uuid]
|
|
||||||
[app.main.data.workspace.colors :as dc]
|
[app.main.data.workspace.colors :as dc]
|
||||||
[app.main.data.workspace.selection :as dws]
|
[app.main.data.workspace.selection :as dws]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
|
@ -57,15 +55,6 @@
|
||||||
groups-ref (h/use-ref-value groups)
|
groups-ref (h/use-ref-value groups)
|
||||||
prev-colors-ref (mf/use-ref nil)
|
prev-colors-ref (mf/use-ref nil)
|
||||||
|
|
||||||
initial-color-keys
|
|
||||||
(mf/with-memo []
|
|
||||||
(->> (concat colors library-colors)
|
|
||||||
(reduce (fn [result color]
|
|
||||||
(assoc result color (dm/str (uuid/next))))
|
|
||||||
{})))
|
|
||||||
|
|
||||||
color-keys* (mf/use-var initial-color-keys)
|
|
||||||
|
|
||||||
on-change
|
on-change
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [new-color old-color from-picker?]
|
(fn [new-color old-color from-picker?]
|
||||||
|
@ -93,7 +82,6 @@
|
||||||
(mf/set-ref-val! prev-colors-ref
|
(mf/set-ref-val! prev-colors-ref
|
||||||
(conj prev-colors color))))
|
(conj prev-colors color))))
|
||||||
|
|
||||||
(swap! color-keys* assoc new-color (get @color-keys* old-color))
|
|
||||||
(st/emit! (dc/change-color-in-selected cops new-color old-color)))))
|
(st/emit! (dc/change-color-in-selected cops new-color old-color)))))
|
||||||
|
|
||||||
on-open
|
on-open
|
||||||
|
@ -138,7 +126,7 @@
|
||||||
lib-colors (concat lib-colors colors)]
|
lib-colors (concat lib-colors colors)]
|
||||||
(for [[index color] (d/enumerate lib-colors)]
|
(for [[index color] (d/enumerate lib-colors)]
|
||||||
[:> color-row*
|
[:> color-row*
|
||||||
{:key (get @color-keys* color)
|
{:key index
|
||||||
:color color
|
:color color
|
||||||
:index index
|
:index index
|
||||||
:hidden (not (:id color))
|
:hidden (not (:id color))
|
||||||
|
@ -155,7 +143,7 @@
|
||||||
[:div {:class (stl/css :selected-color-group)}
|
[:div {:class (stl/css :selected-color-group)}
|
||||||
(for [[index color] (d/enumerate (cond->> colors (not @expand-color) (take 3)))]
|
(for [[index color] (d/enumerate (cond->> colors (not @expand-color) (take 3)))]
|
||||||
[:> color-row*
|
[:> color-row*
|
||||||
{:key (get @color-keys* color)
|
{:key index
|
||||||
:color color
|
:color color
|
||||||
:index index
|
:index index
|
||||||
:select-only select-only
|
:select-only select-only
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue