From f4d513b622ec1949320d33a58bc99e4464ba4b2f Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 21 Feb 2024 17:37:18 +0100 Subject: [PATCH] :bug: Fix problem with import zip file --- frontend/src/app/main/render.cljs | 25 +++++++++++---------- frontend/src/app/main/ui/shapes/export.cljs | 3 +++ frontend/src/app/worker/import/parser.cljs | 5 ++++- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/main/render.cljs b/frontend/src/app/main/render.cljs index be312cae2..60fc6f6be 100644 --- a/frontend/src/app/main/render.cljs +++ b/frontend/src/app/main/render.cljs @@ -509,18 +509,19 @@ (mf/deps objects) (fn [] (frame-wrapper-factory objects)))] - [:> "symbol" #js {:id (str (:id component)) - :viewBox vbox - "penpot:path" path - "penpot:main-instance-id" main-instance-id - "penpot:main-instance-page" main-instance-page - "penpot:main-instance-x" main-instance-x - "penpot:main-instance-y" main-instance-y} - [:title name] - [:> shape-container {:shape root-shape} - (case (:type root-shape) - :group [:& group-wrapper {:shape root-shape :view-box vbox}] - :frame [:& frame-wrapper {:shape root-shape :view-box vbox}])]])) + (when root-shape + [:> "symbol" #js {:id (str (:id component)) + :viewBox vbox + "penpot:path" path + "penpot:main-instance-id" main-instance-id + "penpot:main-instance-page" main-instance-page + "penpot:main-instance-x" main-instance-x + "penpot:main-instance-y" main-instance-y} + [:title name] + [:> shape-container {:shape root-shape} + (case (:type root-shape) + :group [:& group-wrapper {:shape root-shape :view-box vbox}] + :frame [:& frame-wrapper {:shape root-shape :view-box vbox}])]]))) (mf/defc components-svg {::mf/wrap-props false} diff --git a/frontend/src/app/main/ui/shapes/export.cljs b/frontend/src/app/main/ui/shapes/export.cljs index 5c03bf78f..d10378e19 100644 --- a/frontend/src/app/main/ui/shapes/export.cljs +++ b/frontend/src/app/main/ui/shapes/export.cljs @@ -104,6 +104,9 @@ (-> (add! :show-content) (add! :hide-in-viewer))) + (cond-> (and frame? (:use-for-thumbnail shape)) + (add! :use-for-thumbnail)) + (cond-> (and (or rect? image? frame?) (some? (:r1 shape))) (-> (add! :r1) (add! :r2) diff --git a/frontend/src/app/worker/import/parser.cljs b/frontend/src/app/worker/import/parser.cljs index 017a87710..a0da1e60d 100644 --- a/frontend/src/app/worker/import/parser.cljs +++ b/frontend/src/app/worker/import/parser.cljs @@ -820,10 +820,13 @@ (defn add-frame-data [props node] (let [grids (parse-grids node) show-content (get-meta node :show-content str->bool) - hide-in-viewer (get-meta node :hide-in-viewer str->bool)] + hide-in-viewer (get-meta node :hide-in-viewer str->bool) + use-for-thumbnail (get-meta node :use-for-thumbnail str->bool)] (-> props (assoc :show-content show-content) (assoc :hide-in-viewer hide-in-viewer) + (cond-> use-for-thumbnail + (assoc :use-for-thumbnail use-for-thumbnail)) (cond-> (d/not-empty? grids) (assoc :grids grids)))))