0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-20 13:42:59 -05:00

Merge pull request #384 from tokens-studio/andrei/369-export-on-file-without-tokens-crashes

🐛 Export on file without tokens crashes [WIP]
This commit is contained in:
Florian Schrödl 2024-12-11 17:25:35 +01:00 committed by GitHub
commit a7c59bb413
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -323,12 +323,12 @@
:timeout 9000}))))) :timeout 9000})))))
(set! (.-value (mf/ref-val input-ref)) ""))) (set! (.-value (mf/ref-val input-ref)) "")))
on-export (fn [] on-export (fn []
(let [tokens-blob (some-> (deref refs/tokens-lib) (let [tokens-json (some-> (deref refs/tokens-lib)
(ctob/encode-dtcg) (ctob/encode-dtcg)
(clj->js) (clj->js)
(js/JSON.stringify nil 2) (js/JSON.stringify nil 2))]
(wapi/create-blob "application/json"))] (->> (wapi/create-blob (or tokens-json "{}") "application/json")
(dom/trigger-download "tokens.json" tokens-blob)))] (dom/trigger-download "tokens.json"))))]
[:div {:class (stl/css :import-export-button-wrapper)} [:div {:class (stl/css :import-export-button-wrapper)}
[:input {:type "file" [:input {:type "file"