mirror of
https://github.com/penpot/penpot.git
synced 2025-08-02 06:28:24 +02:00
🐛 Fix problem with SVG's import/export
This commit is contained in:
parent
36bb5cbe01
commit
9e7551551f
2 changed files with 29 additions and 11 deletions
|
@ -199,6 +199,18 @@
|
|||
:penpot:suffix suffix
|
||||
:penpot:scale (str scale)}])))
|
||||
|
||||
(defn str->style
|
||||
[style-str]
|
||||
(if (string? style-str)
|
||||
(->> (str/split style-str ";")
|
||||
(map str/trim)
|
||||
(map #(str/split % ":"))
|
||||
(group-by first)
|
||||
(map (fn [[key val]]
|
||||
(vector (keyword key) (second (first val)))))
|
||||
(into {}))
|
||||
style-str))
|
||||
|
||||
(defn style->str
|
||||
[style]
|
||||
(->> style
|
||||
|
@ -229,7 +241,8 @@
|
|||
[:& render-xml {:xml def-xml}]])]))
|
||||
|
||||
(when (= (:type shape) :svg-raw)
|
||||
(let [props
|
||||
(let [shape (-> shape (d/update-in-when [:content :attrs :style] str->style))
|
||||
props
|
||||
(-> (obj/new)
|
||||
(obj/set! "penpot:x" (:x shape))
|
||||
(obj/set! "penpot:y" (:y shape))
|
||||
|
@ -263,7 +276,6 @@
|
|||
(mf/defc export-data
|
||||
[{:keys [shape]}]
|
||||
(let [props (-> (obj/new) (add-data shape) (add-library-refs shape))]
|
||||
(js/console.log props)
|
||||
[:> "penpot:shape" props
|
||||
(export-shadow-data shape)
|
||||
(export-blur-data shape)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue