0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-18 10:41:29 -05:00

🐛 Fix problem with text fills

This commit is contained in:
alonso.torres 2024-04-11 10:24:57 +02:00
parent 9cbbe1565d
commit 2e23f19081

View file

@ -285,11 +285,21 @@
(let [color-attrs (select-keys node [:fill-color :fill-opacity :fill-color-ref-id :fill-color-ref-file :fill-color-gradient])]
(cond-> node
(nil? (:fills node))
(assoc :fills (:fills txt/default-text-attrs))
(assoc :fills [])
(and (d/not-empty? color-attrs) (empty? (:fills node)))
;; Migrate old colors and remove the old fromat
(d/not-empty? color-attrs)
(-> (dissoc :fill-color :fill-opacity :fill-color-ref-id :fill-color-ref-file :fill-color-gradient)
(assoc :fills [color-attrs])))))
(update :fills conj color-attrs))
;; We don't have the fills attribute. It's an old text without color
;; so need to be black
(and (nil? (:fills node)) (empty? color-attrs))
(update :fills conj txt/default-text-attrs)
;; Remove duplicates from the fills
:always
(update :fills (comp vec distinct)))))
(defn migrate-content
[content]
@ -323,7 +333,9 @@
update-shape
(fn [shape]
(d/update-when shape :content update-content))]
(-> shape
(dissoc :fills)
(d/update-when :content update-content)))]
(rx/of (dch/update-shapes shape-ids update-shape)))))))