mirror of
https://github.com/penpot/penpot.git
synced 2025-05-08 23:55:53 +02:00
🐛 Fixes add fill to text shapes
This commit is contained in:
parent
5abc6e3252
commit
1bb056cbdb
1 changed files with 20 additions and 4 deletions
|
@ -42,8 +42,9 @@
|
||||||
[{:keys [ids type values editor] :as props}]
|
[{:keys [ids type values editor] :as props}]
|
||||||
(let [locale (mf/deref i18n/locale)
|
(let [locale (mf/deref i18n/locale)
|
||||||
shapes (deref (refs/objects-by-id ids))
|
shapes (deref (refs/objects-by-id ids))
|
||||||
text-ids (map :id (filter #(= (:type %) :text) shapes))
|
is-text? #(= (:type %) :text)
|
||||||
other-ids (map :id (filter #(not= (:type %) :text) shapes))
|
text-ids (map :id (filter is-text? shapes))
|
||||||
|
other-ids (map :id (filter (comp not is-text?) shapes))
|
||||||
show? (not (nil? (:fill-color values)))
|
show? (not (nil? (:fill-color values)))
|
||||||
|
|
||||||
label (case type
|
label (case type
|
||||||
|
@ -60,14 +61,29 @@
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps ids)
|
(mf/deps ids)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(st/emit! (dwc/update-shapes ids #(assoc % :fill-color cp/default-color)))))
|
(when-not (empty? other-ids)
|
||||||
|
(st/emit! (dwc/update-shapes other-ids #(assoc % :fill-color cp/default-color))))
|
||||||
|
|
||||||
|
(when-not (empty? text-ids)
|
||||||
|
(run! #(st/emit! (dwt/update-text-attrs
|
||||||
|
{:id %
|
||||||
|
:editor editor
|
||||||
|
:attrs {:fill cp/default-color}}))
|
||||||
|
text-ids))))
|
||||||
|
|
||||||
on-delete
|
on-delete
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps ids)
|
(mf/deps ids)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(st/emit! (dwc/update-shapes ids #(dissoc % :fill-color)))))
|
(when-not (empty? other-ids)
|
||||||
|
(st/emit! (dwc/update-shapes other-ids #(dissoc % :fill-color))))
|
||||||
|
|
||||||
|
(when-not (empty? text-ids)
|
||||||
|
(run! #(st/emit! (dwt/update-text-attrs
|
||||||
|
{:id %
|
||||||
|
:editor editor
|
||||||
|
:attrs {:fill nil}}))
|
||||||
|
text-ids))))
|
||||||
|
|
||||||
on-change
|
on-change
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
|
Loading…
Add table
Reference in a new issue