mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05: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}]
|
||||
(let [locale (mf/deref i18n/locale)
|
||||
shapes (deref (refs/objects-by-id ids))
|
||||
text-ids (map :id (filter #(= (:type %) :text) shapes))
|
||||
other-ids (map :id (filter #(not= (:type %) :text) shapes))
|
||||
is-text? #(= (:type %) :text)
|
||||
text-ids (map :id (filter is-text? shapes))
|
||||
other-ids (map :id (filter (comp not is-text?) shapes))
|
||||
show? (not (nil? (:fill-color values)))
|
||||
|
||||
label (case type
|
||||
|
@ -60,14 +61,29 @@
|
|||
(mf/use-callback
|
||||
(mf/deps ids)
|
||||
(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
|
||||
(mf/use-callback
|
||||
(mf/deps ids)
|
||||
(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
|
||||
(mf/use-callback
|
||||
|
|
Loading…
Reference in a new issue