0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-09 08:38:15 -05:00

🐛 Flix blend mode validation when importing svg

This commit is contained in:
Andrés Moya 2023-06-07 17:30:24 +02:00
parent 55a821f193
commit 1d5d5e2499
2 changed files with 5 additions and 6 deletions

View file

@ -30,7 +30,7 @@
(def stroke-caps-marker #{:line-arrow :triangle-arrow :square-marker :circle-marker :diamond-marker}) (def stroke-caps-marker #{:line-arrow :triangle-arrow :square-marker :circle-marker :diamond-marker})
(def stroke-caps (set/union stroke-caps-line stroke-caps-marker)) (def stroke-caps (set/union stroke-caps-line stroke-caps-marker))
(def blend-mode (def blend-modes
#{:normal #{:normal
:darken :darken
:multiply :multiply
@ -139,7 +139,7 @@
[:vector {:gen/max 2} ::stroke]] [:vector {:gen/max 2} ::stroke]]
[:transform {:optional true} ::gmt/matrix] [:transform {:optional true} ::gmt/matrix]
[:transform-inverse {:optional true} ::gmt/matrix] [:transform-inverse {:optional true} ::gmt/matrix]
[:blend-mode {:optional true} [::sm/one-of blend-mode]] [:blend-mode {:optional true} [::sm/one-of blend-modes]]
[:interactions {:optional true} [:interactions {:optional true}
[:vector {:gen/max 2} ::ctsi/interaction]] [:vector {:gen/max 2} ::ctsi/interaction]]
[:shadow {:optional true} [:shadow {:optional true}

View file

@ -31,7 +31,6 @@
[app.util.svg :as usvg] [app.util.svg :as usvg]
[app.util.webapi :as wapi] [app.util.webapi :as wapi]
[beicon.core :as rx] [beicon.core :as rx]
[clojure.spec.alpha :as s]
[cuerdas.core :as str] [cuerdas.core :as str]
[potok.core :as ptk])) [potok.core :as ptk]))
@ -67,7 +66,7 @@
str/trim str/trim
str/lower str/lower
keyword)] keyword)]
(when-not (s/valid? ::cts/blend-mode clean-value) (when-not (contains? cts/blend-modes clean-value)
(ex/raise :type :assertion (ex/raise :type :assertion
:code :expr-validation :code :expr-validation
:hint (str/ffmt "%1 is not a valid blend mode" clean-value))) :hint (str/ffmt "%1 is not a valid blend mode" clean-value)))