mirror of
https://github.com/penpot/penpot.git
synced 2025-05-21 11:56:12 +02:00
🐛 Fix problem when exporting html texts
This commit is contained in:
parent
6f2f2291c2
commit
4b846b17f0
3 changed files with 17 additions and 16 deletions
|
@ -21,10 +21,9 @@
|
||||||
shape (obj/get props "shape")
|
shape (obj/get props "shape")
|
||||||
code? (obj/get props "code?")
|
code? (obj/get props "code?")
|
||||||
text (:text node)
|
text (:text node)
|
||||||
style (when-not code?
|
style (if (= text "")
|
||||||
(if (= text "")
|
(sts/generate-text-styles shape parent)
|
||||||
(sts/generate-text-styles shape parent)
|
(sts/generate-text-styles shape node))
|
||||||
(sts/generate-text-styles shape node)))
|
|
||||||
class (when code? (:$id node))]
|
class (when code? (:$id node))]
|
||||||
[:span.text-node {:style style :class class}
|
[:span.text-node {:style style :class class}
|
||||||
(if (= text "") "\u00A0" text)]))
|
(if (= text "") "\u00A0" text)]))
|
||||||
|
@ -36,7 +35,7 @@
|
||||||
children (obj/get props "children")
|
children (obj/get props "children")
|
||||||
shape (obj/get props "shape")
|
shape (obj/get props "shape")
|
||||||
code? (obj/get props "code?")
|
code? (obj/get props "code?")
|
||||||
style (when-not code? (sts/generate-root-styles shape node))
|
style (sts/generate-root-styles shape node code?)
|
||||||
class (when code? (:$id node))]
|
class (when code? (:$id node))]
|
||||||
[:div.root.rich-text
|
[:div.root.rich-text
|
||||||
{:style style
|
{:style style
|
||||||
|
|
|
@ -17,16 +17,18 @@
|
||||||
[cuerdas.core :as str]))
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
(defn generate-root-styles
|
(defn generate-root-styles
|
||||||
[{:keys [width height]} node]
|
([props node]
|
||||||
(let [valign (:vertical-align node "top")
|
(generate-root-styles props node false))
|
||||||
base #js {:height (fmt/format-pixels height)
|
([{:keys [width height]} node code?]
|
||||||
:width (fmt/format-pixels width)
|
(let [valign (:vertical-align node "top")
|
||||||
:display "flex"
|
base #js {:height (when-not code? (fmt/format-pixels height))
|
||||||
:whiteSpace "break-spaces"}]
|
:width (when-not code? (fmt/format-pixels width))
|
||||||
(cond-> base
|
:display "flex"
|
||||||
(= valign "top") (obj/set! "alignItems" "flex-start")
|
:whiteSpace "break-spaces"}]
|
||||||
(= valign "center") (obj/set! "alignItems" "center")
|
(cond-> base
|
||||||
(= valign "bottom") (obj/set! "alignItems" "flex-end"))))
|
(= valign "top") (obj/set! "alignItems" "flex-start")
|
||||||
|
(= valign "center") (obj/set! "alignItems" "center")
|
||||||
|
(= valign "bottom") (obj/set! "alignItems" "flex-end")))))
|
||||||
|
|
||||||
(defn generate-paragraph-set-styles
|
(defn generate-paragraph-set-styles
|
||||||
[{:keys [grow-type] :as shape}]
|
[{:keys [grow-type] :as shape}]
|
||||||
|
|
|
@ -207,7 +207,7 @@ body {
|
||||||
(let [properties
|
(let [properties
|
||||||
(case (:type node)
|
(case (:type node)
|
||||||
(:root "root")
|
(:root "root")
|
||||||
(sts/generate-root-styles shape node)
|
(sts/generate-root-styles shape node true)
|
||||||
|
|
||||||
(:paragraph-set "paragraph-set")
|
(:paragraph-set "paragraph-set")
|
||||||
(sts/generate-paragraph-set-styles shape)
|
(sts/generate-paragraph-set-styles shape)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue