diff --git a/frontend/src/app/main/ui/shapes/shape.cljs b/frontend/src/app/main/ui/shapes/shape.cljs index a91e2c7e7..62ce22477 100644 --- a/frontend/src/app/main/ui/shapes/shape.cljs +++ b/frontend/src/app/main/ui/shapes/shape.cljs @@ -28,7 +28,10 @@ (-> props (obj/set! ns-attr val)))) frame? (= :frame (:type shape)) - text? (= :text (:type shape))] + group? (= :group (:type shape)) + rect? (= :text (:type shape)) + text? (= :text (:type shape)) + mask? (and group? (:masked-group? shape))] (-> props (add! :name (-> shape :name)) (add! :blocked (-> shape (:blocked false) str)) @@ -41,7 +44,7 @@ (add! :transform (-> shape (:transform (gmt/matrix)) str)) (add! :transform-inverse (-> shape (:transform-inverse (gmt/matrix)) str)) - (cond-> (some? (:r1 shape)) + (cond-> (and rect? (some? (:r1 shape))) (-> (add! :r1 (-> shape (:r1 0) str)) (add! :r2 (-> shape (:r2 0) str)) (add! :r3 (-> shape (:r3 0) str)) @@ -51,6 +54,9 @@ (-> (add! :grow-type (-> shape :grow-type)) (add! :content (-> shape :content json/encode)))) + (cond-> mask? + (add! :masked-group "true")) + (cond-> frame? (obj/set! "xmlns:penpot" "https://penpot.app/xmlns"))))) diff --git a/frontend/src/app/util/import/parser.cljc b/frontend/src/app/util/import/parser.cljc index 3f8cb2627..3753c4af2 100644 --- a/frontend/src/app/util/import/parser.cljc +++ b/frontend/src/app/util/import/parser.cljc @@ -238,6 +238,13 @@ [val] (= val "true")) +(defn add-group-data + [props node] + (let [mask? (get-meta node :masked-group str->bool)] + (cond-> props + mask? + (assoc :masked-group? true)))) + (defn parse-data [type node] @@ -257,6 +264,9 @@ (assoc :blocked blocked) (assoc :hidden hidden) + (cond-> (= :group type) + (add-group-data node)) + (cond-> (= :image type) (add-image-data node data))