mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 14:42:56 +00:00
WIP
This commit is contained in:
@@ -42,22 +42,21 @@
|
||||
(bw/eval! dom
|
||||
(fn [elem]
|
||||
(let [rect (.getBoundingClientRect ^js elem)
|
||||
width (or (some-> (.getAttribute ^js elem "width") js/parseFloat) 0)
|
||||
height (or (some-> (.getAttribute ^js elem "height") js/parseFloat) 0)
|
||||
width (js/Math.max width (.-width rect))
|
||||
height (js/Math.max height (.-height rect))
|
||||
width (js/Math.max (or (some-> (.getAttribute ^js elem "width") js/parseFloat) 0)
|
||||
(.-width rect))
|
||||
height (js/Math.max (or (some-> (.getAttribute ^js elem "height") js/parseFloat) 0)
|
||||
(.-height rect))
|
||||
width-px (str width "px")
|
||||
height-px (str height "px")
|
||||
head (.-head js/document)
|
||||
style-id "penpot-pdf-page-size"
|
||||
style-node (or (.getElementById js/document style-id)
|
||||
(doto (.createElement js/document "style")
|
||||
(set! (.-id %) style-id)
|
||||
(.appendChild head %)))]
|
||||
style-node (or (.getElementById js/document "penpot-pdf-page-size")
|
||||
(let [node (.createElement js/document "style")]
|
||||
(set! (.-id node) "penpot-pdf-page-size")
|
||||
(.appendChild (.-head js/document) node)
|
||||
node))]
|
||||
(set! (.-textContent style-node)
|
||||
(str "@page { size: " width-px " " height-px "; margin: 0; }\n"
|
||||
"html, body, #app { margin: 0; padding: 0; "
|
||||
"width: " width-px "; height: " height-px "; overflow: visible; }\n"))))))
|
||||
"html, body, #app { margin: 0; padding: 0;"
|
||||
"width: " width-px "; height: " height-px "; }"))))))
|
||||
|
||||
(render-object [page base-uri {:keys [id] :as object}]
|
||||
(p/let [uri (prepare-uri base-uri id)
|
||||
|
||||
Reference in New Issue
Block a user