From 389c394f39c9cd8119eff1d768d0e3af8327a9a9 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 10 Apr 2024 11:02:23 +0200 Subject: [PATCH] :bug: Fix import zip text with gradients --- common/src/app/common/files/builder.cljc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/src/app/common/files/builder.cljc b/common/src/app/common/files/builder.cljc index d10b494d9..c30a2e8c8 100644 --- a/common/src/app/common/files/builder.cljc +++ b/common/src/app/common/files/builder.cljc @@ -16,6 +16,7 @@ [app.common.pprint :as pp] [app.common.schema :as sm] [app.common.svg :as csvg] + [app.common.text :as txt] [app.common.types.components-list :as ctkl] [app.common.types.container :as ctn] [app.common.types.file :as ctf] @@ -322,8 +323,19 @@ (defn create-path [file data] (create-shape file :path data)) +(defn- clean-text-content + "Clean the content data so it doesn't break the validation" + [content] + (letfn [(update-fill [fill] + (d/update-in-when fill [:fill-color-gradient :type] keyword))] + (txt/transform-nodes + (fn [node] + (d/update-when node :fills #(mapv update-fill %))) + content))) + (defn create-text [file data] - (create-shape file :text data)) + (let [data (d/update-when data :content clean-text-content)] + (create-shape file :text data))) (defn create-image [file data] (create-shape file :image data))