Revert "defer loading html2canvas"

This reverts commit 16e0c3713f.
This commit is contained in:
Konstantinos Kaloutas
2023-07-03 12:23:30 +03:00
committed by Tienson Qin
parent f9fbb26567
commit fb63c32a56
5 changed files with 12 additions and 9 deletions

View File

@@ -12,8 +12,7 @@
[frontend.state :as state]
[frontend.ui :as ui]
[frontend.util :as util]
[rum.core :as rum]
[promesa.core :as p]))
[rum.core :as rum]))
(rum/defc export
[]
@@ -111,13 +110,13 @@
:scale scale
:windowHeight (when (string? block-uuids-or-page-name)
(.-scrollHeight container))}]
(p/let [_ (util/js-load$ (str util/JS_ROOT "/html2canvas.min.js"))] (-> (js/html2canvas container options)
(.then (fn [canvas] (.toBlob canvas (fn [blob]
(when blob
(let [img (js/document.getElementById "export-preview")
img-url (image/create-object-url blob)]
(set! (.-src img) img-url)
(callback blob)))) "image/png")))))))
(-> (js/html2canvas container options)
(.then (fn [canvas] (.toBlob canvas (fn [blob]
(when blob
(let [img (js/document.getElementById "export-preview")
img-url (image/create-object-url blob)]
(set! (.-src img) img-url)
(callback blob)))) "image/png"))))))
(rum/defcs ^:large-vars/cleanup-todo
export-blocks < rum/static