Return blob when exporting using the lib-penpot

This commit is contained in:
Jordi Sala Morales 2024-06-06 12:40:29 +00:00 committed by Andrey Antukh
parent 4ed6e1e8ec
commit 44b6d1a516

View file

@ -12,7 +12,6 @@
[app.common.media :as cm] [app.common.media :as cm]
[app.common.types.components-list :as ctkl] [app.common.types.components-list :as ctkl]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.util.dom :as dom]
[app.util.json :as json] [app.util.json :as json]
[app.util.webapi :as wapi] [app.util.webapi :as wapi]
[app.util.zip :as uz] [app.util.zip :as uz]
@ -262,12 +261,14 @@
(uuid/next)) (uuid/next))
(export [_] (export [_]
(->> (export-file file) (js/Promise.
(rx/subs! (fn [resolve _reject]
(fn [value] (-> (export-file file)
(when (not (contains? value :type)) (rx/subscribe
(let [[file export-blob] value] (fn [value]
(dom/trigger-download (:name file) export-blob)))))))) (when (not (contains? value :type))
(let [[_ export-blob] value]
(resolve export-blob))))))))))
(defn create-file-export [^string name] (defn create-file-export [^string name]
(binding [cfeat/*current* cfeat/default-features] (binding [cfeat/*current* cfeat/default-features]