diff --git a/frontend/src/app/main/ui/shapes/text/html_text.cljs b/frontend/src/app/main/ui/shapes/text/html_text.cljs index da23426c2..fd3995c38 100644 --- a/frontend/src/app/main/ui/shapes/text/html_text.cljs +++ b/frontend/src/app/main/ui/shapes/text/html_text.cljs @@ -21,10 +21,9 @@ shape (obj/get props "shape") code? (obj/get props "code?") text (:text node) - style (when-not code? - (if (= text "") - (sts/generate-text-styles shape parent) - (sts/generate-text-styles shape node))) + style (if (= text "") + (sts/generate-text-styles shape parent) + (sts/generate-text-styles shape node)) class (when code? (:$id node))] [:span.text-node {:style style :class class} (if (= text "") "\u00A0" text)])) @@ -36,7 +35,7 @@ children (obj/get props "children") shape (obj/get props "shape") 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))] [:div.root.rich-text {:style style diff --git a/frontend/src/app/main/ui/shapes/text/styles.cljs b/frontend/src/app/main/ui/shapes/text/styles.cljs index 534b786e4..c8fbf2053 100644 --- a/frontend/src/app/main/ui/shapes/text/styles.cljs +++ b/frontend/src/app/main/ui/shapes/text/styles.cljs @@ -17,16 +17,18 @@ [cuerdas.core :as str])) (defn generate-root-styles - [{:keys [width height]} node] - (let [valign (:vertical-align node "top") - base #js {:height (fmt/format-pixels height) - :width (fmt/format-pixels width) - :display "flex" - :whiteSpace "break-spaces"}] - (cond-> base - (= valign "top") (obj/set! "alignItems" "flex-start") - (= valign "center") (obj/set! "alignItems" "center") - (= valign "bottom") (obj/set! "alignItems" "flex-end")))) + ([props node] + (generate-root-styles props node false)) + ([{:keys [width height]} node code?] + (let [valign (:vertical-align node "top") + base #js {:height (when-not code? (fmt/format-pixels height)) + :width (when-not code? (fmt/format-pixels width)) + :display "flex" + :whiteSpace "break-spaces"}] + (cond-> base + (= 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 [{:keys [grow-type] :as shape}] diff --git a/frontend/src/app/util/code_gen/style_css.cljs b/frontend/src/app/util/code_gen/style_css.cljs index 5f1776044..3a1ace59f 100644 --- a/frontend/src/app/util/code_gen/style_css.cljs +++ b/frontend/src/app/util/code_gen/style_css.cljs @@ -207,7 +207,7 @@ body { (let [properties (case (:type node) (:root "root") - (sts/generate-root-styles shape node) + (sts/generate-root-styles shape node true) (:paragraph-set "paragraph-set") (sts/generate-paragraph-set-styles shape)