From 1d5d5e2499105b0d0a28f87313004388924e6e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Wed, 7 Jun 2023 17:30:24 +0200 Subject: [PATCH] :bug: Flix blend mode validation when importing svg --- common/src/app/common/types/shape.cljc | 4 ++-- frontend/src/app/main/data/workspace/svg_upload.cljs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/src/app/common/types/shape.cljc b/common/src/app/common/types/shape.cljc index ebb35990a..89c229959 100644 --- a/common/src/app/common/types/shape.cljc +++ b/common/src/app/common/types/shape.cljc @@ -30,7 +30,7 @@ (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 blend-mode +(def blend-modes #{:normal :darken :multiply @@ -139,7 +139,7 @@ [:vector {:gen/max 2} ::stroke]] [:transform {: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} [:vector {:gen/max 2} ::ctsi/interaction]] [:shadow {:optional true} diff --git a/frontend/src/app/main/data/workspace/svg_upload.cljs b/frontend/src/app/main/data/workspace/svg_upload.cljs index 0e4e4e10b..7e9d99d67 100644 --- a/frontend/src/app/main/data/workspace/svg_upload.cljs +++ b/frontend/src/app/main/data/workspace/svg_upload.cljs @@ -31,7 +31,6 @@ [app.util.svg :as usvg] [app.util.webapi :as wapi] [beicon.core :as rx] - [clojure.spec.alpha :as s] [cuerdas.core :as str] [potok.core :as ptk])) @@ -67,10 +66,10 @@ str/trim str/lower keyword)] - (when-not (s/valid? ::cts/blend-mode clean-value) + (when-not (contains? cts/blend-modes clean-value) (ex/raise :type :assertion - :code :expr-validation - :hint (str/ffmt "%1 is not a valid blend mode" clean-value))) + :code :expr-validation + :hint (str/ffmt "%1 is not a valid blend mode" clean-value))) clean-value)) (defn- svg-dimensions [data]