diff --git a/CHANGES.md b/CHANGES.md index dad802389..b05b7c1a6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -38,6 +38,7 @@ - Fix confirm group name with enter doesn't work in assets modal [Taiga #4506](https://tree.taiga.io/project/penpot/issue/4506) - Fix group/ungroup shapes inside a component [Taiga #4052](https://tree.taiga.io/project/penpot/issue/4052) - Fix wrong update of text in components [Taiga #4646](https://tree.taiga.io/project/penpot/issue/4646) +- Fix problem with SVG imports with style [#2605](https://github.com/penpot/penpot/issues/2605) ## 1.16.2-beta diff --git a/frontend/src/app/main/ui/shapes/svg_raw.cljs b/frontend/src/app/main/ui/shapes/svg_raw.cljs index 3c71526af..6a744745b 100644 --- a/frontend/src/app/main/ui/shapes/svg_raw.cljs +++ b/frontend/src/app/main/ui/shapes/svg_raw.cljs @@ -110,7 +110,7 @@ (for [item childs] [:& shape-wrapper {:shape item :key (dm/str (:id item))}])] - (and svg-leaf? valid-tag?) + svg-leaf? content :else nil)))) diff --git a/frontend/src/app/main/ui/workspace/shapes.cljs b/frontend/src/app/main/ui/workspace/shapes.cljs index 35148dc16..1bc7e29d0 100644 --- a/frontend/src/app/main/ui/workspace/shapes.cljs +++ b/frontend/src/app/main/ui/workspace/shapes.cljs @@ -98,9 +98,17 @@ (and (some? active-frames) (not (contains? active-frames (:id shape)))) - opts #js {:shape shape :thumbnail? thumbnail?}] + opts #js {:shape shape :thumbnail? thumbnail?} + + svg-leaf? (and (= :svg-raw (:type shape)) (string? (:content shape))) + + [wrapper wrapper-props] + (if svg-leaf? + [mf/Fragment nil] + ["g" #js {:className "workspace-shape-wrapper"}])] + (when (and (some? shape) (not (:hidden shape))) - [:g.workspace-shape-wrapper + [:> wrapper wrapper-props (case (:type shape) :path [:> path/path-wrapper opts] :text [:> text/text-wrapper opts] diff --git a/frontend/src/app/util/svg.cljs b/frontend/src/app/util/svg.cljs index 04b23ebf0..8a44d6450 100644 --- a/frontend/src/app/util/svg.cljs +++ b/frontend/src/app/util/svg.cljs @@ -21,7 +21,7 @@ (defonce matrices-regex #"(matrix|translate|scale|rotate|skewX|skewY)\(([^\)]*)\)") (defonce number-regex #"[+-]?\d*(\.\d+)?(e[+-]?\d+)?") -(defonce tags-to-remove #{:defs :linearGradient :radialGradient :metadata :mask :clipPath :filter :title}) +(defonce tags-to-remove #{:linearGradient :radialGradient :metadata :mask :clipPath :filter :title}) ;; https://www.w3.org/TR/SVG11/eltindex.html (defonce svg-tags-list