From ba40b99c9776852d45f419be2d3fce625802e986 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 23 Feb 2017 21:36:40 +0100 Subject: [PATCH] Allow text selection on view app. --- frontend/src/uxbox/main/ui/shapes/text.cljs | 9 ++++++--- frontend/src/uxbox/view/ui/viewer/shapes.cljs | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/src/uxbox/main/ui/shapes/text.cljs b/frontend/src/uxbox/main/ui/shapes/text.cljs index e57e37f6a..120c52fe1 100644 --- a/frontend/src/uxbox/main/ui/shapes/text.cljs +++ b/frontend/src/uxbox/main/ui/shapes/text.cljs @@ -70,16 +70,18 @@ font-size text-align line-height - letter-spacing] + letter-spacing + user-select] :or {fill-color "#000000" fill-opacity 1 font-family "sourcesanspro" font-weight "normal" font-style "normal" - fobt-size 16 + font-size 18 line-height 1.4 letter-spacing 1 - text-align "left"} + text-align "left" + user-select false} :as shape}] (let [color (-> fill-color (color/hex->rgba fill-opacity) @@ -92,6 +94,7 @@ :fontFamily font-family :fontWeight font-weight :fontStyle font-style} + (when user-select {:userSelect "auto"}) (when line-height {:lineHeight line-height}) (when letter-spacing {:letterSpacing letter-spacing})))) diff --git a/frontend/src/uxbox/view/ui/viewer/shapes.cljs b/frontend/src/uxbox/view/ui/viewer/shapes.cljs index fc023d5d1..1ad369c89 100644 --- a/frontend/src/uxbox/view/ui/viewer/shapes.cljs +++ b/frontend/src/uxbox/view/ui/viewer/shapes.cljs @@ -84,6 +84,13 @@ (when-let [image (mx/react (image-ref image))] (image-shape (assoc item :image image)))) +;; --- Text Shape Wrapper + +(mx/defc text-shape-wrapper + {:mixins [mx/static]} + [item] + (text-shape (assoc item :user-select true))) + ;; --- Shapes (declare shape) @@ -93,7 +100,7 @@ (case type :group (group-shape item shape) :image (image-shape-wrapper item) - :text (text-shape item) + :text (text-shape-wrapper item) :icon (icon-shape item) :rect (rect-shape item) :path (path-shape item)