mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 11:56:12 +02:00
🐛 Export/import of images doesn't work for .zip format
This commit is contained in:
parent
46a9535f35
commit
034170afac
3 changed files with 7 additions and 4 deletions
|
@ -16,6 +16,7 @@
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.main.ui.context :as muc]
|
[app.main.ui.context :as muc]
|
||||||
[app.main.ui.shapes.attrs :as attrs]
|
[app.main.ui.shapes.attrs :as attrs]
|
||||||
|
[app.main.ui.shapes.embed :as embed]
|
||||||
[app.main.ui.shapes.gradients :as grad]
|
[app.main.ui.shapes.gradients :as grad]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
|
@ -213,6 +214,7 @@
|
||||||
:force-transform (cfh/path-shape? shape)}
|
:force-transform (cfh/path-shape? shape)}
|
||||||
stroke-image (:stroke-image stroke)
|
stroke-image (:stroke-image stroke)
|
||||||
uri (when stroke-image (cf/resolve-file-media stroke-image))
|
uri (when stroke-image (cf/resolve-file-media stroke-image))
|
||||||
|
embed (embed/use-data-uris [uri])
|
||||||
|
|
||||||
stroke-width (case (:stroke-alignment stroke :center)
|
stroke-width (case (:stroke-alignment stroke :center)
|
||||||
:center (/ (:stroke-width stroke 0) 2)
|
:center (/ (:stroke-width stroke 0) 2)
|
||||||
|
@ -229,7 +231,7 @@
|
||||||
|
|
||||||
w (+ (dm/get-prop selrect :width) (* 2 stroke-margin))
|
w (+ (dm/get-prop selrect :width) (* 2 stroke-margin))
|
||||||
h (+ (dm/get-prop selrect :height) (* 2 stroke-margin))
|
h (+ (dm/get-prop selrect :height) (* 2 stroke-margin))
|
||||||
image-props #js {:href uri
|
image-props #js {:href (get embed uri uri)
|
||||||
:preserveAspectRatio "xMidYMid slice"
|
:preserveAspectRatio "xMidYMid slice"
|
||||||
:width 1
|
:width 1
|
||||||
:height 1
|
:height 1
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
(->> (http/fetch-data-uri uri true)
|
(->> (http/fetch-data-uri uri true)
|
||||||
;; If fetching give an error we store the URI as its `data-uri`
|
;; If fetching give an error we store the URI as its `data-uri`
|
||||||
(rx/catch #(rx/of (hash-map uri uri)))))))
|
(rx/catch #(rx/of (hash-map uri uri)))))))
|
||||||
(rx/map identity obs)))
|
(rx/map (fn [uri] {uri uri}) obs)))
|
||||||
|
|
||||||
sub (->> (rx/from urls)
|
sub (->> (rx/from urls)
|
||||||
(rx/filter some?)
|
(rx/filter some?)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
[app.common.geom.shapes.text :as gst]
|
[app.common.geom.shapes.text :as gst]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.main.ui.shapes.attrs :as attrs]
|
[app.main.ui.shapes.attrs :as attrs]
|
||||||
|
[app.main.ui.shapes.embed :as embed]
|
||||||
[app.main.ui.shapes.gradients :as grad]
|
[app.main.ui.shapes.gradients :as grad]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
@ -57,7 +58,7 @@
|
||||||
(keep :fill-image)
|
(keep :fill-image)
|
||||||
(map cf/resolve-file-media))
|
(map cf/resolve-file-media))
|
||||||
fills)
|
fills)
|
||||||
|
embed (embed/use-data-uris uris)
|
||||||
transform (gsh/transform-str shape)
|
transform (gsh/transform-str shape)
|
||||||
|
|
||||||
pat-props #js {:patternUnits "userSpaceOnUse"
|
pat-props #js {:patternUnits "userSpaceOnUse"
|
||||||
|
@ -119,7 +120,7 @@
|
||||||
(let [uri (cf/resolve-file-media (:fill-image value))
|
(let [uri (cf/resolve-file-media (:fill-image value))
|
||||||
keep-ar? (-> value :fill-image :keep-aspect-ratio)
|
keep-ar? (-> value :fill-image :keep-aspect-ratio)
|
||||||
image-props #js {:id (dm/str "fill-image-" render-id "-" fill-index)
|
image-props #js {:id (dm/str "fill-image-" render-id "-" fill-index)
|
||||||
:href (get uris uri uri)
|
:href (get embed uri uri)
|
||||||
:preserveAspectRatio (if keep-ar? "xMidYMid slice" "none")
|
:preserveAspectRatio (if keep-ar? "xMidYMid slice" "none")
|
||||||
:width width
|
:width width
|
||||||
:height height
|
:height height
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue