mirror of
https://github.com/penpot/penpot.git
synced 2026-08-26 14:48:43 +00:00
🐛 Add migrations to fix wrongly migrated data
Also port the migration introduced in main branch for the recent hotfix
This commit is contained in:
parent
ba398569c1
commit
6f7f74f7c6
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
(ns app.common.data
|
(ns app.common.data
|
||||||
"Data manipulation and query helper functions."
|
"Data manipulation and query helper functions."
|
||||||
(:refer-clojure :exclude [read-string hash-map merge name parse-double group-by iteration])
|
(:refer-clojure :exclude [read-string hash-map merge name update-vals
|
||||||
|
parse-double group-by iteration])
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(:require-macros [app.common.data]))
|
(:require-macros [app.common.data]))
|
||||||
(:require
|
(:require
|
||||||
@ -198,6 +199,23 @@
|
|||||||
([mfn coll]
|
([mfn coll]
|
||||||
(into {} (mapm mfn) coll)))
|
(into {} (mapm mfn) coll)))
|
||||||
|
|
||||||
|
;; TEMPORARY COPY of clojure.core/update-vals until we migrate to clojure 1.11
|
||||||
|
|
||||||
|
(defn update-vals
|
||||||
|
"m f => {k (f v) ...}
|
||||||
|
Given a map m and a function f of 1-argument, returns a new map where the keys of m
|
||||||
|
are mapped to result of applying f to the corresponding values of m."
|
||||||
|
[m f]
|
||||||
|
(with-meta
|
||||||
|
(persistent!
|
||||||
|
(reduce-kv (fn [acc k v] (assoc! acc k (f v)))
|
||||||
|
(if #?(:clj (instance? clojure.lang.IEditableCollection m)
|
||||||
|
:cljs (implements? core/IEditableCollection m))
|
||||||
|
(transient m)
|
||||||
|
(transient {}))
|
||||||
|
m))
|
||||||
|
(meta m)))
|
||||||
|
|
||||||
(defn removev
|
(defn removev
|
||||||
"Returns a vector of the items in coll for which (fn item) returns logical false"
|
"Returns a vector of the items in coll for which (fn item) returns logical false"
|
||||||
[fn coll]
|
[fn coll]
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
[app.common.colors :as clr]
|
[app.common.colors :as clr]
|
||||||
[app.common.uuid :as uuid]))
|
[app.common.uuid :as uuid]))
|
||||||
|
|
||||||
(def file-version 16)
|
(def file-version 17)
|
||||||
(def default-color clr/gray-20)
|
(def default-color clr/gray-20)
|
||||||
(def root uuid/zero)
|
(def root uuid/zero)
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,10 @@
|
|||||||
[{:keys [type]}]
|
[{:keys [type]}]
|
||||||
(= type :text))
|
(= type :text))
|
||||||
|
|
||||||
|
(defn ^boolean image-shape?
|
||||||
|
[{:keys [type]}]
|
||||||
|
(= type :image))
|
||||||
|
|
||||||
(defn ^boolean unframed-shape?
|
(defn ^boolean unframed-shape?
|
||||||
"Checks if it's a non-frame shape in the top level."
|
"Checks if it's a non-frame shape in the top level."
|
||||||
[shape]
|
[shape]
|
||||||
|
|||||||
@ -12,7 +12,9 @@
|
|||||||
[app.common.geom.shapes.path :as gsp]
|
[app.common.geom.shapes.path :as gsp]
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[app.common.pages :as cp]
|
[app.common.pages :as cp]
|
||||||
[app.common.uuid :as uuid]))
|
[app.common.pages.helpers :as cph]
|
||||||
|
[app.common.uuid :as uuid]
|
||||||
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
;; TODO: revisit this and rename to file-migrations
|
;; TODO: revisit this and rename to file-migrations
|
||||||
|
|
||||||
@ -45,17 +47,16 @@
|
|||||||
;; Ensure that all :shape attributes on shapes are vectors.
|
;; Ensure that all :shape attributes on shapes are vectors.
|
||||||
(defmethod migrate 2
|
(defmethod migrate 2
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-object [_ object]
|
(letfn [(update-object [object]
|
||||||
(d/update-when object :shapes
|
(d/update-when object :shapes
|
||||||
(fn [shapes]
|
(fn [shapes]
|
||||||
(if (seq? shapes)
|
(if (seq? shapes)
|
||||||
(into [] shapes)
|
(into [] shapes)
|
||||||
shapes))))
|
shapes))))
|
||||||
|
(update-page [page]
|
||||||
|
(update page :objects d/update-vals update-object))]
|
||||||
|
|
||||||
(update-page [_ page]
|
(update data :pages-index d/update-vals update-page)))
|
||||||
(update page :objects #(d/mapm update-object %)))]
|
|
||||||
|
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
|
||||||
|
|
||||||
;; Changes paths formats
|
;; Changes paths formats
|
||||||
(defmethod migrate 3
|
(defmethod migrate 3
|
||||||
@ -89,7 +90,7 @@
|
|||||||
(empty? (:points shape))
|
(empty? (:points shape))
|
||||||
(assoc :points (gsh/rect->points (:selrect shape))))))
|
(assoc :points (gsh/rect->points (:selrect shape))))))
|
||||||
|
|
||||||
(update-object [_ object]
|
(update-object [object]
|
||||||
(cond-> object
|
(cond-> object
|
||||||
(= :curve (:type object))
|
(= :curve (:type object))
|
||||||
(assoc :type :path)
|
(assoc :type :path)
|
||||||
@ -97,25 +98,22 @@
|
|||||||
(#{:curve :path} (:type object))
|
(#{:curve :path} (:type object))
|
||||||
(migrate-path)
|
(migrate-path)
|
||||||
|
|
||||||
(= :frame (:type object))
|
(cph/frame-shape? object)
|
||||||
(fix-frames-selrects)
|
(fix-frames-selrects)
|
||||||
|
|
||||||
(and (empty? (:points object)) (not= (:id object) uuid/zero))
|
(and (empty? (:points object)) (not= (:id object) uuid/zero))
|
||||||
(fix-empty-points)
|
(fix-empty-points)
|
||||||
|
|
||||||
|
;; Setup an empty transformation to re-calculate selrects
|
||||||
|
;; and points data
|
||||||
:always
|
:always
|
||||||
(->
|
(-> (assoc :modifiers {:displacement (gmt/matrix)})
|
||||||
;; Setup an empty transformation to re-calculate selrects
|
(gsh/transform-shape))))
|
||||||
;; and points data
|
|
||||||
(assoc :modifiers {:displacement (gmt/matrix)})
|
|
||||||
(gsh/transform-shape))
|
|
||||||
|
|
||||||
))
|
(update-page [page]
|
||||||
|
(update page :objects d/update-vals update-object))]
|
||||||
|
|
||||||
(update-page [_ page]
|
(update data :pages-index d/update-vals update-page)))
|
||||||
(update page :objects #(d/mapm update-object %)))]
|
|
||||||
|
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
|
||||||
|
|
||||||
;; We did rollback version 4 migration.
|
;; We did rollback version 4 migration.
|
||||||
;; Keep this in order to remember the next version to be 5
|
;; Keep this in order to remember the next version to be 5
|
||||||
@ -124,61 +122,55 @@
|
|||||||
;; Put the id of the local file in :component-file in instances of local components
|
;; Put the id of the local file in :component-file in instances of local components
|
||||||
(defmethod migrate 5
|
(defmethod migrate 5
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-object [_ object]
|
(letfn [(update-object [object]
|
||||||
(if (and (some? (:component-id object))
|
(if (and (some? (:component-id object))
|
||||||
(nil? (:component-file object)))
|
(nil? (:component-file object)))
|
||||||
(assoc object :component-file (:id data))
|
(assoc object :component-file (:id data))
|
||||||
object))
|
object))
|
||||||
|
|
||||||
(update-page [_ page]
|
(update-page [page]
|
||||||
(update page :objects #(d/mapm update-object %)))]
|
(update page :objects d/update-vals update-object))]
|
||||||
|
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
|
||||||
|
|
||||||
(defn fix-line-paths
|
|
||||||
"Fixes issues with selrect/points for shapes with width/height = 0 (line-like paths)"
|
|
||||||
[_ shape]
|
|
||||||
(if (= (:type shape) :path)
|
|
||||||
(let [{:keys [width height]} (gsh/points->rect (:points shape))]
|
|
||||||
(if (or (mth/almost-zero? width) (mth/almost-zero? height))
|
|
||||||
(let [selrect (gsh/content->selrect (:content shape))
|
|
||||||
points (gsh/rect->points selrect)
|
|
||||||
transform (gmt/matrix)
|
|
||||||
transform-inv (gmt/matrix)]
|
|
||||||
(assoc shape
|
|
||||||
:selrect selrect
|
|
||||||
:points points
|
|
||||||
:transform transform
|
|
||||||
:transform-inverse transform-inv))
|
|
||||||
shape))
|
|
||||||
shape))
|
|
||||||
|
|
||||||
|
(update data :pages-index d/update-vals update-page)))
|
||||||
|
|
||||||
(defmethod migrate 6
|
(defmethod migrate 6
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-container [_ container]
|
;; Fixes issues with selrect/points for shapes with width/height = 0 (line-like paths)"
|
||||||
(-> container
|
(letfn [(fix-line-paths [shape]
|
||||||
(update :objects #(d/mapm fix-line-paths %))))]
|
(if (= (:type shape) :path)
|
||||||
|
(let [{:keys [width height]} (gsh/points->rect (:points shape))]
|
||||||
|
(if (or (mth/almost-zero? width) (mth/almost-zero? height))
|
||||||
|
(let [selrect (gsh/content->selrect (:content shape))
|
||||||
|
points (gsh/rect->points selrect)
|
||||||
|
transform (gmt/matrix)
|
||||||
|
transform-inv (gmt/matrix)]
|
||||||
|
(assoc shape
|
||||||
|
:selrect selrect
|
||||||
|
:points points
|
||||||
|
:transform transform
|
||||||
|
:transform-inverse transform-inv))
|
||||||
|
shape))
|
||||||
|
shape))
|
||||||
|
|
||||||
|
(update-container [container]
|
||||||
|
(update container :objects d/update-vals fix-line-paths))]
|
||||||
|
|
||||||
(-> data
|
(-> data
|
||||||
(update :components #(d/mapm update-container %))
|
(update :pages-index d/update-vals update-container)
|
||||||
(update :pages-index #(d/mapm update-container %)))))
|
(update :components d/update-vals update-container))))
|
||||||
|
|
||||||
|
|
||||||
;; Remove interactions pointing to deleted frames
|
;; Remove interactions pointing to deleted frames
|
||||||
(defmethod migrate 7
|
(defmethod migrate 7
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-object [page _ object]
|
(letfn [(update-object [page object]
|
||||||
(d/update-when object :interactions
|
(d/update-when object :interactions
|
||||||
(fn [interactions]
|
(fn [interactions]
|
||||||
(filterv #(get-in page [:objects (:destination %)])
|
(filterv #(get-in page [:objects (:destination %)]) interactions))))
|
||||||
interactions))))
|
|
||||||
|
|
||||||
(update-page [_ page]
|
(update-page [page]
|
||||||
(update page :objects #(d/mapm (partial update-object page) %)))]
|
(update page :objects d/update-vals (partial update-object page)))]
|
||||||
|
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
|
||||||
|
|
||||||
|
(update data :pages-index d/update-vals update-page)))
|
||||||
|
|
||||||
;; Remove groups without any shape, both in pages and components
|
;; Remove groups without any shape, both in pages and components
|
||||||
|
|
||||||
@ -210,7 +202,7 @@
|
|||||||
[(count deleted)
|
[(count deleted)
|
||||||
(d/mapm #(clean-parents %2 deleted) result)]))))
|
(d/mapm #(clean-parents %2 deleted) result)]))))
|
||||||
|
|
||||||
(clean-container [_ container]
|
(clean-container [container]
|
||||||
(loop [n 0
|
(loop [n 0
|
||||||
objects (:objects container)]
|
objects (:objects container)]
|
||||||
(let [[deleted objects] (clean-objects objects)]
|
(let [[deleted objects] (clean-objects objects)]
|
||||||
@ -219,8 +211,8 @@
|
|||||||
(assoc container :objects objects)))))]
|
(assoc container :objects objects)))))]
|
||||||
|
|
||||||
(-> data
|
(-> data
|
||||||
(update :pages-index #(d/mapm clean-container %))
|
(update :pages-index d/update-vals clean-container)
|
||||||
(d/update-when :components #(d/mapm clean-container %)))))
|
(update :components d/update-vals clean-container))))
|
||||||
|
|
||||||
(defmethod migrate 9
|
(defmethod migrate 9
|
||||||
[data]
|
[data]
|
||||||
@ -252,35 +244,35 @@
|
|||||||
|
|
||||||
(defmethod migrate 10
|
(defmethod migrate 10
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-page [_ page]
|
(letfn [(update-page [page]
|
||||||
(d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))]
|
(d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))]
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
(update data :pages-index d/update-vals update-page)))
|
||||||
|
|
||||||
(defmethod migrate 11
|
(defmethod migrate 11
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-object [objects _id shape]
|
(letfn [(update-object [objects shape]
|
||||||
(if (= :frame (:type shape))
|
(if (cph/frame-shape? shape)
|
||||||
(d/update-when shape :shapes (fn [shapes]
|
(d/update-when shape :shapes (fn [shapes]
|
||||||
(filterv (fn [id] (contains? objects id)) shapes)))
|
(filterv (fn [id] (contains? objects id)) shapes)))
|
||||||
shape))
|
shape))
|
||||||
|
|
||||||
(update-page [_ page]
|
(update-page [page]
|
||||||
(update page :objects #(d/mapm (partial update-object %) %)))]
|
(update page :objects (fn [objects]
|
||||||
|
(d/update-vals objects (partial update-object objects)))))]
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
|
||||||
|
|
||||||
|
(update data :pages-index d/update-vals update-page)))
|
||||||
|
|
||||||
(defmethod migrate 12
|
(defmethod migrate 12
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-grid [_key grid]
|
(letfn [(update-grid [grid]
|
||||||
(cond-> grid
|
(cond-> grid
|
||||||
(= :auto (:size grid))
|
(= :auto (:size grid))
|
||||||
(assoc :size nil)))
|
(assoc :size nil)))
|
||||||
|
|
||||||
(update-page [_id page]
|
(update-page [page]
|
||||||
(d/update-in-when page [:options :saved-grids] #(d/mapm update-grid %)))]
|
(d/update-in-when page [:options :saved-grids] d/update-vals update-grid))]
|
||||||
|
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
(update data :pages-index d/update-vals update-page)))
|
||||||
|
|
||||||
;; Add rx and ry to images
|
;; Add rx and ry to images
|
||||||
(defmethod migrate 13
|
(defmethod migrate 13
|
||||||
@ -291,83 +283,124 @@
|
|||||||
(assoc :rx 0)
|
(assoc :rx 0)
|
||||||
(assoc :ry 0))
|
(assoc :ry 0))
|
||||||
shape))
|
shape))
|
||||||
(update-object [_ object]
|
|
||||||
|
(update-object [object]
|
||||||
(cond-> object
|
(cond-> object
|
||||||
(= :image (:type object))
|
(cph/image-shape? object)
|
||||||
(fix-radius)))
|
(fix-radius)))
|
||||||
|
|
||||||
(update-page [_ page]
|
(update-page [page]
|
||||||
(update page :objects #(d/mapm update-object %)))]
|
(update page :objects d/update-vals update-object))]
|
||||||
|
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
(update data :pages-index d/update-vals update-page)))
|
||||||
|
|
||||||
(defn set-fills
|
|
||||||
[shape]
|
|
||||||
(let [attrs {:fill-color (:fill-color shape)
|
|
||||||
:fill-color-gradient (:fill-color-gradient shape)
|
|
||||||
:fill-color-ref-file (:fill-color-ref-file shape)
|
|
||||||
:fill-color-ref-id (:fill-color-ref-id shape)
|
|
||||||
:fill-opacity (:fill-opacity shape)}
|
|
||||||
|
|
||||||
clean-attrs (d/without-nils attrs)]
|
|
||||||
(cond-> shape
|
|
||||||
(d/not-empty? clean-attrs)
|
|
||||||
(assoc :fills [clean-attrs]))))
|
|
||||||
|
|
||||||
;; Add fills to shapes
|
|
||||||
(defmethod migrate 14
|
(defmethod migrate 14
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-object [_ object]
|
(letfn [(process-shape [shape]
|
||||||
(cond-> object
|
(let [fill-color (str/upper (:fill-color shape))
|
||||||
(and (not (= :text (:type object))) (nil? (:fills object)))
|
fill-opacity (:fill-opacity shape)]
|
||||||
(set-fills)))
|
(cond-> shape
|
||||||
|
(and (= 1 fill-opacity)
|
||||||
|
(or (= "#B1B2B5" fill-color)
|
||||||
|
(= "#7B7D85" fill-color)))
|
||||||
|
(dissoc :fill-color :fill-opacity))))
|
||||||
|
|
||||||
(update-page [_ page]
|
(update-container [{:keys [objects] :as container}]
|
||||||
(update page :objects #(d/mapm update-object %)))]
|
(loop [objects objects
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
shapes (->> (vals objects)
|
||||||
|
(filter cph/image-shape?))]
|
||||||
|
(if-let [shape (first shapes)]
|
||||||
|
(let [{:keys [id frame-id] :as shape'} (process-shape shape)]
|
||||||
|
(if (identical? shape shape')
|
||||||
|
(recur objects (rest shapes))
|
||||||
|
(recur (-> objects
|
||||||
|
(assoc id shape')
|
||||||
|
(d/update-when frame-id dissoc :thumbnail))
|
||||||
|
(rest shapes))))
|
||||||
|
(assoc container :objects objects))))]
|
||||||
|
|
||||||
(defn set-strokes
|
(-> data
|
||||||
[shape]
|
(update :pages-index d/update-vals update-container)
|
||||||
(let [attrs {:stroke-style (:stroke-style shape)
|
(update :components d/update-vals update-container))))
|
||||||
:stroke-alignment (:stroke-alignment shape)
|
|
||||||
:stroke-width (:stroke-width shape)
|
|
||||||
:stroke-color (:stroke-color shape)
|
|
||||||
:stroke-color-ref-id (:stroke-color-ref-id shape)
|
|
||||||
:stroke-color-ref-file (:stroke-color-ref-file shape)
|
|
||||||
:stroke-opacity (:stroke-opacity shape)
|
|
||||||
:stroke-color-gradient (:stroke-color-gradient shape)
|
|
||||||
:stroke-cap-start (:stroke-cap-start shape)
|
|
||||||
:stroke-cap-end (:stroke-cap-end shape)}
|
|
||||||
|
|
||||||
clean-attrs (d/without-nils attrs)]
|
|
||||||
(cond-> shape
|
|
||||||
(d/not-empty? clean-attrs)
|
|
||||||
(assoc :strokes [clean-attrs]))))
|
|
||||||
|
|
||||||
;; Add strokes to shapes
|
(defmethod migrate 15 [data] data)
|
||||||
(defmethod migrate 15
|
|
||||||
[data]
|
|
||||||
(letfn [(update-object [_ object]
|
|
||||||
(cond-> object
|
|
||||||
(and (not (= :text (:type object))) (nil? (:strokes object)))
|
|
||||||
(set-strokes)))
|
|
||||||
|
|
||||||
(update-page [_ page]
|
|
||||||
(update page :objects #(d/mapm update-object %)))]
|
|
||||||
(update data :pages-index #(d/mapm update-page %))))
|
|
||||||
|
|
||||||
;; Add fills and strokes to components
|
|
||||||
|
|
||||||
|
;; Add fills and strokes
|
||||||
(defmethod migrate 16
|
(defmethod migrate 16
|
||||||
[data]
|
[data]
|
||||||
(letfn [(update-object [_ object]
|
(letfn [(assign-fills [shape]
|
||||||
(cond-> object
|
(let [attrs {:fill-color (:fill-color shape)
|
||||||
(and (not (= :text (:type object))) (nil? (:strokes object)))
|
:fill-color-gradient (:fill-color-gradient shape)
|
||||||
(set-strokes)
|
:fill-color-ref-file (:fill-color-ref-file shape)
|
||||||
|
:fill-color-ref-id (:fill-color-ref-id shape)
|
||||||
|
:fill-opacity (:fill-opacity shape)}
|
||||||
|
clean-attrs (d/without-nils attrs)]
|
||||||
|
(cond-> shape
|
||||||
|
(d/not-empty? clean-attrs)
|
||||||
|
(assoc :fills [clean-attrs]))))
|
||||||
|
|
||||||
|
(assign-strokes [shape]
|
||||||
|
(let [attrs {:stroke-style (:stroke-style shape)
|
||||||
|
:stroke-alignment (:stroke-alignment shape)
|
||||||
|
:stroke-width (:stroke-width shape)
|
||||||
|
:stroke-color (:stroke-color shape)
|
||||||
|
:stroke-color-ref-id (:stroke-color-ref-id shape)
|
||||||
|
:stroke-color-ref-file (:stroke-color-ref-file shape)
|
||||||
|
:stroke-opacity (:stroke-opacity shape)
|
||||||
|
:stroke-color-gradient (:stroke-color-gradient shape)
|
||||||
|
:stroke-cap-start (:stroke-cap-start shape)
|
||||||
|
:stroke-cap-end (:stroke-cap-end shape)}
|
||||||
|
clean-attrs (d/without-nils attrs)]
|
||||||
|
(cond-> shape
|
||||||
|
(d/not-empty? clean-attrs)
|
||||||
|
(assoc :strokes [clean-attrs]))))
|
||||||
|
|
||||||
|
(update-object [object]
|
||||||
|
(cond-> object
|
||||||
|
(and (not (cph/text-shape? object))
|
||||||
|
(not (contains? object :strokes)))
|
||||||
|
(assign-strokes)
|
||||||
|
|
||||||
|
(and (not (cph/text-shape? object))
|
||||||
|
(not (contains? object :fills)))
|
||||||
|
(assign-fills)))
|
||||||
|
|
||||||
|
(update-container [container]
|
||||||
|
(update container :objects d/update-vals update-object))]
|
||||||
|
|
||||||
(and (not (= :text (:type object))) (nil? (:fills object)))
|
|
||||||
(set-fills)))
|
|
||||||
(update-container [_ container]
|
|
||||||
(update container :objects #(d/mapm update-object %)))]
|
|
||||||
(-> data
|
(-> data
|
||||||
(update :components #(d/mapm update-container %)))))
|
(update :pages-index d/update-vals update-container)
|
||||||
|
(update :components d/update-vals update-container))))
|
||||||
|
|
||||||
|
(defmethod migrate 17
|
||||||
|
[data]
|
||||||
|
(letfn [(affected-object? [object]
|
||||||
|
(and (cph/image-shape? object)
|
||||||
|
(some? (:fills object))
|
||||||
|
(= 1 (count (:fills object)))
|
||||||
|
(some? (:fill-color object))
|
||||||
|
(some? (:fill-opacity object))
|
||||||
|
(let [color-old (str/upper (:fill-color object))
|
||||||
|
color-new (str/upper (get-in object [:fills 0 :fill-color]))
|
||||||
|
opacity-old (:fill-opacity object)
|
||||||
|
opacity-new (get-in object [:fills 0 :fill-opacity])]
|
||||||
|
(and (= color-old color-new)
|
||||||
|
(or (= "#B1B2B5" color-old)
|
||||||
|
(= "#7B7D85" color-old))
|
||||||
|
(= 1 opacity-old opacity-new)))))
|
||||||
|
|
||||||
|
(update-object [object]
|
||||||
|
(cond-> object
|
||||||
|
(affected-object? object)
|
||||||
|
(assoc :fills [])))
|
||||||
|
|
||||||
|
(update-container [container]
|
||||||
|
(update container :objects d/update-vals update-object))]
|
||||||
|
|
||||||
|
(-> data
|
||||||
|
(update :pages-index d/update-vals update-container)
|
||||||
|
(update :components d/update-vals update-container))))
|
||||||
|
|
||||||
|
;; TODO: pending to do a migration for delete already not used fill
|
||||||
|
;; and stroke props. This should be done for >1.14.x version.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user