mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 08:41:39 +02:00
🐛 Fix incorrect svg-attrs handlng on .zip import process
This commit is contained in:
parent
77472aabea
commit
b6c257bfc5
7 changed files with 56 additions and 92 deletions
|
@ -29,7 +29,7 @@
|
|||
|
||||
(cond
|
||||
(map? node)
|
||||
[:> (d/name tag) (clj->js (csvg/clean-attrs attrs))
|
||||
[:> (d/name tag) (obj/map->obj (csvg/attrs->props attrs))
|
||||
(for [child content]
|
||||
[:& render-xml {:xml child :key (swap! internal-counter inc)}])]
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.geom.shapes.bounds :as gsb]
|
||||
[app.common.svg :as csvg]
|
||||
[app.util.object :as obj]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(defn add-matrix [attrs transform-key transform-matrix]
|
||||
|
@ -23,7 +24,9 @@
|
|||
(str transform-matrix " " val)
|
||||
(str transform-matrix)))))
|
||||
|
||||
(mf/defc svg-node [{:keys [type node prefix-id transform bounds]}]
|
||||
(mf/defc svg-node
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [type node prefix-id transform bounds]}]
|
||||
(cond
|
||||
(string? node) node
|
||||
|
||||
|
@ -48,7 +51,7 @@
|
|||
attrs
|
||||
(-> attrs
|
||||
(csvg/update-attr-ids prefix-id)
|
||||
(csvg/clean-attrs)
|
||||
(csvg/attrs->props)
|
||||
;; This clasname will be used to change the transform on the viewport
|
||||
;; only necessary for groups because shapes have their own transform
|
||||
(cond-> (and (or transform-gradient?
|
||||
|
@ -80,7 +83,7 @@
|
|||
:transform (str transform)}]
|
||||
[mf/Fragment #js {}])]
|
||||
|
||||
[:> (name tag) (clj->js attrs)
|
||||
[:> (name tag) (obj/map->obj attrs)
|
||||
[:> wrapper wrapper-props
|
||||
(for [[index node] (d/enumerate content)]
|
||||
[:& svg-node {:key (dm/str "node-" index)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.svg :as csvg]
|
||||
[app.main.ui.context :as muc]
|
||||
[app.main.ui.shapes.attrs :as usa]
|
||||
[app.main.ui.shapes.attrs :as attrs]
|
||||
[app.util.object :as obj]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.v2 :as mf]))
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
props (mf/with-memo [shape render-id]
|
||||
(-> #js {}
|
||||
(usa/add-fill-props! shape render-id)
|
||||
(attrs/add-fill-props! shape render-id)
|
||||
(obj/unset! "transform")
|
||||
(obj/set! "x" x)
|
||||
(obj/set! "y" y)
|
||||
|
@ -79,8 +79,7 @@
|
|||
props
|
||||
(mf/with-memo [shape render-id]
|
||||
(let [element-id (dm/get-in shape [:svg-attrs :id])
|
||||
props (-> #js {}
|
||||
(usa/add-fill-props! shape render-id))]
|
||||
props (attrs/add-fill-props! #js {} shape render-id)]
|
||||
|
||||
(when (and (some? element-id)
|
||||
(contains? ids-mapping element-id))
|
||||
|
|
|
@ -199,7 +199,8 @@
|
|||
(rx/tap #(progress! context :upload-media name))
|
||||
(rx/merge-map #(rp/cmd! :upload-file-media-object %))))
|
||||
|
||||
(defn resolve-text-content [node context]
|
||||
(defn resolve-text-content
|
||||
[node context]
|
||||
(let [resolve (:resolve context)]
|
||||
(->> node
|
||||
(ct/transform-nodes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue