mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 12:26:10 +02:00
🐛 Fix import problems
This commit is contained in:
parent
0bb20197f1
commit
76abd6796e
3 changed files with 39 additions and 30 deletions
|
@ -216,9 +216,11 @@
|
||||||
(let [;; The nodes with the "frame-background" class can have some anidation depending on the strokes they have
|
(let [;; The nodes with the "frame-background" class can have some anidation depending on the strokes they have
|
||||||
g-nodes (find-all-nodes node :g)
|
g-nodes (find-all-nodes node :g)
|
||||||
defs-nodes (flatten (map #(find-all-nodes % :defs) g-nodes))
|
defs-nodes (flatten (map #(find-all-nodes % :defs) g-nodes))
|
||||||
|
gg-nodes (flatten (map #(find-all-nodes % :g) g-nodes))
|
||||||
rect-nodes (flatten [[(find-all-nodes node :rect)]
|
rect-nodes (flatten [[(find-all-nodes node :rect)]
|
||||||
(map #(find-all-nodes % #{:rect :path}) defs-nodes)
|
(map #(find-all-nodes % #{:rect :path}) defs-nodes)
|
||||||
(map #(find-all-nodes % #{:rect :path}) g-nodes)])
|
(map #(find-all-nodes % #{:rect :path}) g-nodes)
|
||||||
|
(map #(find-all-nodes % #{:rect :path}) gg-nodes)])
|
||||||
svg-node (d/seek #(= "frame-background" (get-in % [:attrs :class])) rect-nodes)]
|
svg-node (d/seek #(= "frame-background" (get-in % [:attrs :class])) rect-nodes)]
|
||||||
(merge (add-attrs {} (:attrs svg-node)) node-attrs))
|
(merge (add-attrs {} (:attrs svg-node)) node-attrs))
|
||||||
|
|
||||||
|
|
|
@ -302,8 +302,9 @@
|
||||||
(reduce simplify-command [[start] start-pos start-pos start-pos start-pos])
|
(reduce simplify-command [[start] start-pos start-pos start-pos start-pos])
|
||||||
(first))))
|
(first))))
|
||||||
|
|
||||||
|
|
||||||
(defn parse-path [path-str]
|
(defn parse-path [path-str]
|
||||||
|
(if (empty? path-str)
|
||||||
|
path-str
|
||||||
(let [clean-path-str
|
(let [clean-path-str
|
||||||
(-> path-str
|
(-> path-str
|
||||||
(str/trim)
|
(str/trim)
|
||||||
|
@ -313,5 +314,5 @@
|
||||||
(str/replace #"\s+" " "))
|
(str/replace #"\s+" " "))
|
||||||
commands (re-seq commands-regex clean-path-str)]
|
commands (re-seq commands-regex clean-path-str)]
|
||||||
(-> (mapcat parse-command commands)
|
(-> (mapcat parse-command commands)
|
||||||
(simplify-commands))))
|
(simplify-commands)))))
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
;; Upload changes batches size
|
;; Upload changes batches size
|
||||||
(def ^:const change-batch-size 100)
|
(def ^:const change-batch-size 100)
|
||||||
|
|
||||||
|
(def conjv (fnil conj []))
|
||||||
|
|
||||||
(defn get-file
|
(defn get-file
|
||||||
"Resolves the file inside the context given its id and the data"
|
"Resolves the file inside the context given its id and the data"
|
||||||
([context type]
|
([context type]
|
||||||
|
@ -261,9 +263,9 @@
|
||||||
(cond-> (some? old-id)
|
(cond-> (some? old-id)
|
||||||
(assoc :id (resolve old-id)))
|
(assoc :id (resolve old-id)))
|
||||||
(cond-> (< (:version context 1) 2)
|
(cond-> (< (:version context 1) 2)
|
||||||
(translate-frame type file)))
|
(translate-frame type file)))]
|
||||||
|
(try
|
||||||
file (case type
|
(let [file (case type
|
||||||
:frame (fb/add-artboard file data)
|
:frame (fb/add-artboard file data)
|
||||||
:group (fb/add-group file data)
|
:group (fb/add-group file data)
|
||||||
:bool (fb/add-bool file data)
|
:bool (fb/add-bool file data)
|
||||||
|
@ -279,7 +281,11 @@
|
||||||
;; added
|
;; added
|
||||||
(cond-> file
|
(cond-> file
|
||||||
(d/not-empty? interactions)
|
(d/not-empty? interactions)
|
||||||
(assoc-in [:interactions (:id data)] interactions))))))
|
(assoc-in [:interactions (:id data)] interactions)))
|
||||||
|
|
||||||
|
(catch :default err
|
||||||
|
(log/error :hint (ex-message err) :cause err :js/data data)
|
||||||
|
(update file :errors conjv data)))))))
|
||||||
|
|
||||||
(defn setup-interactions
|
(defn setup-interactions
|
||||||
[file]
|
[file]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue