Merge pull request #4713 from penpot/hiru-bugs-export-zip

Fix bugs in the export to zip file
This commit is contained in:
Alejandro 2024-06-11 07:33:01 +02:00 committed by GitHub
commit 88e2e11634
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 92 additions and 10 deletions

View file

@ -149,7 +149,7 @@
svg-raw-wrapper (mf/use-memo (mf/deps objects) #(svg-raw-wrapper-factory objects))
bool-wrapper (mf/use-memo (mf/deps objects) #(bool-wrapper-factory objects))
frame-wrapper (mf/use-memo (mf/deps objects) #(frame-wrapper-factory objects))]
(when (and shape (not (:hidden shape)))
(when shape
(let [opts #js {:shape shape}
svg-raw? (= :svg-raw (:type shape))]
(if-not svg-raw?

View file

@ -50,6 +50,9 @@
(defn bool->str [val]
(when (some? val) (str val)))
(defn touched->str [val]
(str/join " " (map str val)))
(defn add-factory [shape]
(fn add!
([props attr]
@ -136,7 +139,6 @@
(cond-> bool?
(add! :bool-type)))))
(defn add-library-refs [props shape]
(let [add! (add-factory shape)]
(-> props
@ -150,7 +152,8 @@
(add! :component-id)
(add! :component-root)
(add! :main-instance)
(add! :shape-ref))))
(add! :shape-ref)
(add! :touched touched->str))))
(defn prefix-keys [m]
(letfn [(prefix-entry [[k v]]

View file

@ -72,6 +72,8 @@
(obj/set! "pointerEvents" pointer-events)
(cond-> (not (cfh/frame-shape? shape))
(obj/set! "opacity" (:opacity shape)))
(cond-> (:hidden shape)
(obj/set! "display" "none"))
(cond-> (and blend-mode (not= blend-mode :normal))
(obj/set! "mixBlendMode" (d/name blend-mode))))

View file

@ -12,6 +12,7 @@
[app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt]
[app.common.svg.path :as svg.path]
[app.common.types.component :as ctk]
[app.common.types.shape.interactions :as ctsi]
[app.common.uuid :as uuid]
[app.util.json :as json]
@ -129,6 +130,15 @@
(into {}))
style-str))
(defn parse-touched
"Transform a string of :touched-groups into a set"
[touched-str]
(let [touched (->> (str/split touched-str " ")
(map #(keyword (subs % 1)))
(filter ctk/valid-touched-group?)
(into #{}))]
touched))
(defn add-attrs
[m attrs]
(reduce-kv
@ -424,7 +434,8 @@
component-file (get-meta node :component-file uuid/uuid)
shape-ref (get-meta node :shape-ref uuid/uuid)
component-root? (get-meta node :component-root str->bool)
main-instance? (get-meta node :main-instance str->bool)]
main-instance? (get-meta node :main-instance str->bool)
touched (get-meta node :touched parse-touched)]
(cond-> props
(some? stroke-color-ref-id)
@ -442,7 +453,10 @@
(assoc :main-instance main-instance?)
(some? shape-ref)
(assoc :shape-ref shape-ref))))
(assoc :shape-ref shape-ref)
(seq touched)
(assoc :touched touched))))
(defn add-fill
[props node svg-data]