mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 14:12:36 -05:00
Merge pull request #5218 from penpot/niwinz-bugfix-10
🐛 Fix issues with invalid fills
This commit is contained in:
commit
f4ae8ea5ac
5 changed files with 54 additions and 24 deletions
|
@ -6,4 +6,4 @@
|
||||||
|
|
||||||
(ns app.common.files.defaults)
|
(ns app.common.files.defaults)
|
||||||
|
|
||||||
(def version 55)
|
(def version 56)
|
||||||
|
|
|
@ -1075,6 +1075,33 @@
|
||||||
|
|
||||||
(update data :pages-index d/update-vals update-page)))
|
(update data :pages-index d/update-vals update-page)))
|
||||||
|
|
||||||
|
(defn migrate-up-56
|
||||||
|
[data]
|
||||||
|
(letfn [(fix-fills [object]
|
||||||
|
(d/update-when object :fills (partial filterv valid-fill?)))
|
||||||
|
|
||||||
|
(update-object [object]
|
||||||
|
(-> object
|
||||||
|
(fix-fills)
|
||||||
|
|
||||||
|
;; If shape contains shape-ref but has a nil value, we
|
||||||
|
;; should remove it from shape object
|
||||||
|
(cond-> (and (contains? object :shape-ref)
|
||||||
|
(nil? (get object :shape-ref)))
|
||||||
|
(dissoc :shape-ref))
|
||||||
|
|
||||||
|
;; The text shape also can has fills on the text
|
||||||
|
;; fragments so we need to fix fills there
|
||||||
|
(cond-> (cfh/text-shape? object)
|
||||||
|
(update :content (partial txt/transform-nodes identity fix-fills)))))
|
||||||
|
|
||||||
|
(update-container [container]
|
||||||
|
(d/update-when container :objects update-vals update-object))]
|
||||||
|
|
||||||
|
(-> data
|
||||||
|
(update :pages-index update-vals update-container)
|
||||||
|
(update :components update-vals update-container))))
|
||||||
|
|
||||||
(def migrations
|
(def migrations
|
||||||
"A vector of all applicable migrations"
|
"A vector of all applicable migrations"
|
||||||
[{:id 2 :migrate-up migrate-up-2}
|
[{:id 2 :migrate-up migrate-up-2}
|
||||||
|
@ -1121,4 +1148,5 @@
|
||||||
{:id 52 :migrate-up migrate-up-52}
|
{:id 52 :migrate-up migrate-up-52}
|
||||||
{:id 53 :migrate-up migrate-up-26}
|
{:id 53 :migrate-up migrate-up-26}
|
||||||
{:id 54 :migrate-up migrate-up-54}
|
{:id 54 :migrate-up migrate-up-54}
|
||||||
{:id 55 :migrate-up migrate-up-55}])
|
{:id 55 :migrate-up migrate-up-55}
|
||||||
|
{:id 56 :migrate-up migrate-up-56}])
|
||||||
|
|
|
@ -56,8 +56,8 @@
|
||||||
(def schema:image-color
|
(def schema:image-color
|
||||||
[:map {:title "ImageColor"}
|
[:map {:title "ImageColor"}
|
||||||
[:name {:optional true} :string]
|
[:name {:optional true} :string]
|
||||||
[:width :int]
|
[:width ::sm/int]
|
||||||
[:height :int]
|
[:height ::sm/int]
|
||||||
[:mtype {:optional true} [:maybe :string]]
|
[:mtype {:optional true} [:maybe :string]]
|
||||||
[:id ::sm/uuid]
|
[:id ::sm/uuid]
|
||||||
[:keep-aspect-ratio {:optional true} :boolean]])
|
[:keep-aspect-ratio {:optional true} :boolean]])
|
||||||
|
|
|
@ -224,8 +224,8 @@
|
||||||
[:map {:title "ImageAttrs"}
|
[:map {:title "ImageAttrs"}
|
||||||
[:metadata
|
[:metadata
|
||||||
[:map
|
[:map
|
||||||
[:width {:gen/gen (sg/small-int :min 1)} :int]
|
[:width {:gen/gen (sg/small-int :min 1)} ::sm/int]
|
||||||
[:height {:gen/gen (sg/small-int :min 1)} :int]
|
[:height {:gen/gen (sg/small-int :min 1)} ::sm/int]
|
||||||
[:mtype {:optional true
|
[:mtype {:optional true
|
||||||
:gen/gen (sg/elements ["image/jpeg"
|
:gen/gen (sg/elements ["image/jpeg"
|
||||||
"image/png"])}
|
"image/png"])}
|
||||||
|
|
|
@ -226,27 +226,27 @@
|
||||||
|
|
||||||
change-event-type
|
change-event-type
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (keyword event)]
|
(let [value (keyword event)]
|
||||||
(update-interaction index #(ctsi/set-event-type % value shape)))))
|
(update-interaction index #(ctsi/set-event-type % value shape)))))
|
||||||
|
|
||||||
change-action-type
|
change-action-type
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (keyword event)]
|
(let [value (keyword event)]
|
||||||
(update-interaction index #(ctsi/set-action-type % value)))))
|
(update-interaction index #(ctsi/set-action-type % value)))))
|
||||||
|
|
||||||
change-delay
|
change-delay
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [value]
|
(fn [value]
|
||||||
(update-interaction index #(ctsi/set-delay % value))))
|
(update-interaction index #(ctsi/set-delay % value))))
|
||||||
|
|
||||||
change-destination
|
change-destination
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value event
|
(let [value event
|
||||||
value (when (not= value "") (uuid/uuid value))]
|
value (when (not= value "") (uuid/uuid value))]
|
||||||
|
@ -254,21 +254,21 @@
|
||||||
|
|
||||||
change-position-relative-to
|
change-position-relative-to
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (uuid/uuid event)]
|
(let [value (uuid/uuid event)]
|
||||||
(update-interaction index #(ctsi/set-position-relative-to % value)))))
|
(update-interaction index #(ctsi/set-position-relative-to % value)))))
|
||||||
|
|
||||||
change-preserve-scroll
|
change-preserve-scroll
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (-> event dom/get-target dom/checked?)]
|
(let [value (-> event dom/get-target dom/checked?)]
|
||||||
(update-interaction index #(ctsi/set-preserve-scroll % value)))))
|
(update-interaction index #(ctsi/set-preserve-scroll % value)))))
|
||||||
|
|
||||||
change-url
|
change-url
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [target (dom/get-target event)
|
(let [target (dom/get-target event)
|
||||||
value (dom/get-value target)
|
value (dom/get-value target)
|
||||||
|
@ -287,7 +287,7 @@
|
||||||
|
|
||||||
change-overlay-pos-type
|
change-overlay-pos-type
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps shape)
|
(mf/deps shape update-interaction)
|
||||||
(fn [value]
|
(fn [value]
|
||||||
(let [shape-id (:id shape)]
|
(let [shape-id (:id shape)]
|
||||||
(update-interaction index #(ctsi/set-overlay-pos-type % value shape objects))
|
(update-interaction index #(ctsi/set-overlay-pos-type % value shape objects))
|
||||||
|
@ -296,7 +296,7 @@
|
||||||
|
|
||||||
toggle-overlay-pos-type
|
toggle-overlay-pos-type
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [pos-type (-> (dom/get-current-target event)
|
(let [pos-type (-> (dom/get-current-target event)
|
||||||
(dom/get-data "value")
|
(dom/get-data "value")
|
||||||
|
@ -305,21 +305,21 @@
|
||||||
|
|
||||||
change-close-click-outside
|
change-close-click-outside
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (-> event dom/get-target dom/checked?)]
|
(let [value (-> event dom/get-target dom/checked?)]
|
||||||
(update-interaction index #(ctsi/set-close-click-outside % value)))))
|
(update-interaction index #(ctsi/set-close-click-outside % value)))))
|
||||||
|
|
||||||
change-background-overlay
|
change-background-overlay
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (-> event dom/get-target dom/checked?)]
|
(let [value (-> event dom/get-target dom/checked?)]
|
||||||
(update-interaction index #(ctsi/set-background-overlay % value)))))
|
(update-interaction index #(ctsi/set-background-overlay % value)))))
|
||||||
|
|
||||||
change-animation-type
|
change-animation-type
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (if (= "" event)
|
(let [value (if (= "" event)
|
||||||
nil
|
nil
|
||||||
|
@ -327,33 +327,35 @@
|
||||||
(update-interaction index #(ctsi/set-animation-type % value)))))
|
(update-interaction index #(ctsi/set-animation-type % value)))))
|
||||||
|
|
||||||
change-duration
|
change-duration
|
||||||
(mf/use-fn (fn [value]
|
(mf/use-fn
|
||||||
|
(mf/deps index update-interaction)
|
||||||
|
(fn [value]
|
||||||
(update-interaction index #(ctsi/set-duration % value))))
|
(update-interaction index #(ctsi/set-duration % value))))
|
||||||
|
|
||||||
change-easing
|
change-easing
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (keyword event)]
|
(let [value (keyword event)]
|
||||||
(update-interaction index #(ctsi/set-easing % value)))))
|
(update-interaction index #(ctsi/set-easing % value)))))
|
||||||
|
|
||||||
change-way
|
change-way
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (keyword event)]
|
(let [value (keyword event)]
|
||||||
(update-interaction index #(ctsi/set-way % value)))))
|
(update-interaction index #(ctsi/set-way % value)))))
|
||||||
|
|
||||||
change-direction
|
change-direction
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (keyword event)]
|
(let [value (keyword event)]
|
||||||
(update-interaction index #(ctsi/set-direction % value)))))
|
(update-interaction index #(ctsi/set-direction % value)))))
|
||||||
|
|
||||||
change-offset-effect
|
change-offset-effect
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps index)
|
(mf/deps index update-interaction)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (-> event dom/get-target dom/checked?)]
|
(let [value (-> event dom/get-target dom/checked?)]
|
||||||
(update-interaction index #(ctsi/set-offset-effect % value)))))
|
(update-interaction index #(ctsi/set-offset-effect % value)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue