mirror of
https://github.com/penpot/penpot.git
synced 2025-03-29 08:01:41 -05:00
Merge pull request #4419 from penpot/alotor-bugfix-43
🐛 Fix problem with text fills
This commit is contained in:
commit
66845033ab
1 changed files with 16 additions and 4 deletions
|
@ -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])]
|
(let [color-attrs (select-keys node [:fill-color :fill-opacity :fill-color-ref-id :fill-color-ref-file :fill-color-gradient])]
|
||||||
(cond-> node
|
(cond-> node
|
||||||
(nil? (:fills 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)
|
(-> (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
|
(defn migrate-content
|
||||||
[content]
|
[content]
|
||||||
|
@ -323,7 +333,9 @@
|
||||||
|
|
||||||
update-shape
|
update-shape
|
||||||
(fn [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)))))))
|
(rx/of (dch/update-shapes shape-ids update-shape)))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue