0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 17:00:36 -05:00

🐛 Fix crash when removing multiple text fills

This commit is contained in:
alonso.torres 2024-04-12 12:41:55 +02:00
parent e636bdd0b0
commit cbac4587cf

View file

@ -69,33 +69,34 @@
on-add
(mf/use-fn
(mf/deps ids)
(mf/deps ids fills)
(fn [_]
(st/emit! (dc/add-fill ids {:color default-color
:opacity 1}))
(when (not (some? (seq fills))) (open-content))))
(when (or (= :multiple fills)
(not (some? (seq fills))))
(open-content))))
on-change
(mf/use-fn
(mf/deps ids)
(fn [index]
(fn [color]
(st/emit! (dc/change-fill ids color index)))))
(fn [index]
(fn [color]
(st/emit! (dc/change-fill ids color index))))
on-reorder
(mf/use-fn
(mf/deps ids)
(fn [new-index]
(fn [index]
(st/emit! (dc/reorder-fills ids index new-index)))))
(fn [new-index]
(fn [index]
(st/emit! (dc/reorder-fills ids index new-index))))
on-remove
(fn [index]
(fn []
(st/emit! (dc/remove-fill ids {:color default-color
:opacity 1} index))
(when (= 1 (count (seq fills))) (close-content))))
(when (or (= :multiple fills)
(= 1 (count (seq fills))))
(close-content))))
on-remove-all
(fn [_]
(st/emit! (dc/remove-all-fills ids {:color clr/black