diff --git a/frontend/src/app/main/ui/shapes/text/styles.cljs b/frontend/src/app/main/ui/shapes/text/styles.cljs index c859d2c0c..46839ae4f 100644 --- a/frontend/src/app/main/ui/shapes/text/styles.cljs +++ b/frontend/src/app/main/ui/shapes/text/styles.cljs @@ -20,28 +20,31 @@ ([props] (generate-root-styles (clj->js (obj/get props "node")) props)) ([data props] (let [valign (obj/get data "vertical-align" "top") - talign (obj/get data "text-align" "flex-start") shape (obj/get props "shape") base #js {:height (or (:height shape) "100%") - :width (or (:width shape) "100%") - :display "flex"}] + :width (or (:width shape) "100%")}] (cond-> base - (= valign "top") (obj/set! "alignItems" "flex-start") - (= valign "center") (obj/set! "alignItems" "center") - (= valign "bottom") (obj/set! "alignItems" "flex-end") - - (= talign "left") (obj/set! "justifyContent" "flex-start") - (= talign "center") (obj/set! "justifyContent" "center") - (= talign "right") (obj/set! "justifyContent" "flex-end") - (= talign "justify") (obj/set! "justifyContent" "stretch"))))) + (= valign "top") (obj/set! "justifyContent" "flex-start") + (= valign "center") (obj/set! "justifyContent" "center") + (= valign "bottom") (obj/set! "justifyContent" "flex-end") + )))) (defn generate-paragraph-set-styles - ([props] (generate-paragraph-set-styles nil props)) + ([props] (generate-paragraph-set-styles (clj->js (obj/get props "node")) props)) ([data props] - ;; The position absolute is used so the paragraph is "outside" - ;; the normal layout and can grow outside its parent - ;; We use this element to measure the size of the text - (let [base #js {:display "inline-block"}] + ;; This element will control the auto-width/auto-height size for the + ;; shape. The properties try to adjust to the shape and "overflow" if + ;; the shape is not big enough. + ;; We `inherit` the property `justify-content` so it's set by the root where + ;; the property it's known. + ;; `inline-flex` is similar to flex but `overflows` outside the bounds of the + ;; parent + (let [base #js {:display "inline-flex" + :flex-direction "column" + :justify-content "inherit" + :min-height "100%" + :min-width "100%" + :vertical-align "top"}] base))) (defn generate-paragraph-styles