mirror of
https://github.com/penpot/penpot.git
synced 2025-03-29 08:01:41 -05:00
🐛 Fix invalid colors on file library on comp-v2 migration
This commit is contained in:
parent
e4e566240f
commit
04be6b13be
1 changed files with 18 additions and 5 deletions
|
@ -105,7 +105,12 @@
|
||||||
;; FILE PREPARATION BEFORE MIGRATION
|
;; FILE PREPARATION BEFORE MIGRATION
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(def valid-color? (sm/lazy-validator ::ctc/recent-color))
|
(def valid-recent-color?
|
||||||
|
(sm/lazy-validator ::ctc/recent-color))
|
||||||
|
|
||||||
|
(def valid-color?
|
||||||
|
(sm/lazy-validator ::ctc/color))
|
||||||
|
|
||||||
(def valid-fill? (sm/lazy-validator ::cts/fill))
|
(def valid-fill? (sm/lazy-validator ::cts/fill))
|
||||||
(def valid-stroke? (sm/lazy-validator ::cts/stroke))
|
(def valid-stroke? (sm/lazy-validator ::cts/stroke))
|
||||||
(def valid-flow? (sm/lazy-validator ::ctp/flow))
|
(def valid-flow? (sm/lazy-validator ::ctp/flow))
|
||||||
|
@ -223,9 +228,17 @@
|
||||||
;; fix that issues.
|
;; fix that issues.
|
||||||
fix-file-data
|
fix-file-data
|
||||||
(fn [file-data]
|
(fn [file-data]
|
||||||
(-> file-data
|
(letfn [(fix-colors-library [colors]
|
||||||
(d/update-when :colors dissoc nil)
|
(let [colors (dissoc colors nil)]
|
||||||
(d/update-when :typographies dissoc nil)))
|
(reduce-kv (fn [colors id color]
|
||||||
|
(if (valid-color? color)
|
||||||
|
colors
|
||||||
|
(dissoc colors id)))
|
||||||
|
colors
|
||||||
|
colors)))]
|
||||||
|
(-> file-data
|
||||||
|
(d/update-when :colors fix-colors-library)
|
||||||
|
(d/update-when :typographies dissoc nil))))
|
||||||
|
|
||||||
delete-big-geometry-shapes
|
delete-big-geometry-shapes
|
||||||
(fn [file-data]
|
(fn [file-data]
|
||||||
|
@ -416,7 +429,7 @@
|
||||||
;; Remove invalid colors in :recent-colors
|
;; Remove invalid colors in :recent-colors
|
||||||
(d/update-when file-data :recent-colors
|
(d/update-when file-data :recent-colors
|
||||||
(fn [colors]
|
(fn [colors]
|
||||||
(filterv valid-color? colors))))
|
(filterv valid-recent-color? colors))))
|
||||||
|
|
||||||
fix-broken-parents
|
fix-broken-parents
|
||||||
(fn [file-data]
|
(fn [file-data]
|
||||||
|
|
Loading…
Add table
Reference in a new issue