From 86b5ed48fdd095fdfc85ae02e48bd7099eabc9fe Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 21 Jul 2020 15:05:40 +0200 Subject: [PATCH] :bug: Fix text shape edition mode after creation. --- frontend/src/uxbox/main/data/workspace.cljs | 10 ++++++---- frontend/src/uxbox/main/data/workspace/drawing.cljs | 8 ++++---- .../src/uxbox/main/ui/workspace/shapes/text.cljs | 12 ++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/frontend/src/uxbox/main/data/workspace.cljs b/frontend/src/uxbox/main/data/workspace.cljs index ab1449383..9cbc8e0d1 100644 --- a/frontend/src/uxbox/main/data/workspace.cljs +++ b/frontend/src/uxbox/main/data/workspace.cljs @@ -35,6 +35,7 @@ [uxbox.common.geom.point :as gpt] [uxbox.common.geom.shapes :as geom] [uxbox.common.math :as mth] + [uxbox.util.timers :as ts] [uxbox.util.router :as rt] [uxbox.util.transit :as t] [uxbox.util.webapi :as wapi])) @@ -464,10 +465,11 @@ uchange {:type :del-obj :id id}] - (rx/of (dwc/commit-changes [rchange] [uchange] {:commit-local? true}) - (dws/select-shapes (d/ordered-set id)) - (when (= :text (:type attrs)) - (start-edition-mode id))))))) + (rx/concat + (rx/of (dwc/commit-changes [rchange] [uchange] {:commit-local? true}) + (dws/select-shapes (d/ordered-set id))) + (->> (rx/of (start-edition-mode id)) + (rx/observe-on :async))))))) (defn- calculate-centered-box [state aspect-ratio] diff --git a/frontend/src/uxbox/main/data/workspace/drawing.cljs b/frontend/src/uxbox/main/data/workspace/drawing.cljs index c42a1fc88..f823ddfa7 100644 --- a/frontend/src/uxbox/main/data/workspace/drawing.cljs +++ b/frontend/src/uxbox/main/data/workspace/drawing.cljs @@ -12,15 +12,15 @@ (:require [beicon.core :as rx] [potok.core :as ptk] - [uxbox.main.data.workspace :as dw] - [uxbox.common.geom.shapes :as geom] [uxbox.common.geom.point :as gpt] + [uxbox.common.geom.shapes :as geom] [uxbox.common.pages :as cp] [uxbox.common.pages-helpers :as cph] - [uxbox.util.geom.path :as path] + [uxbox.common.uuid :as uuid] + [uxbox.main.data.workspace :as dw] [uxbox.main.snap :as snap] [uxbox.main.streams :as ms] - [uxbox.common.uuid :as uuid])) + [uxbox.util.geom.path :as path])) (declare handle-drawing) (declare handle-drawing-generic) diff --git a/frontend/src/uxbox/main/ui/workspace/shapes/text.cljs b/frontend/src/uxbox/main/ui/workspace/shapes/text.cljs index 0e2478d33..6e94ce282 100644 --- a/frontend/src/uxbox/main/ui/workspace/shapes/text.cljs +++ b/frontend/src/uxbox/main/ui/workspace/shapes/text.cljs @@ -51,15 +51,15 @@ (mf/defc text-wrapper {::mf/wrap-props false} [props] - (let [shape (unchecked-get props "shape") - {:keys [id x1 y1 content group]} shape - selected (mf/deref refs/selected-shapes) - edition (mf/deref refs/selected-edition) - edition? (= edition id) + (let [{:keys [id x1 y1 content group] :as shape} (unchecked-get props "shape") + + selected (mf/deref refs/selected-shapes) + edition (mf/deref refs/selected-edition) + edition? (= edition id) selected? (and (contains? selected id) (= (count selected) 1)) - on-mouse-down #(handle-mouse-down % shape) + on-mouse-down #(handle-mouse-down % shape) on-context-menu #(common/on-context-menu % shape) on-double-click