0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-08 16:18:11 -05:00

🐛 Fix text shape edition mode after creation.

This commit is contained in:
Andrey Antukh 2020-07-21 15:05:40 +02:00 committed by Hirunatan
parent 36f4948ad1
commit 86b5ed48fd
3 changed files with 16 additions and 14 deletions

View file

@ -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]

View file

@ -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)

View file

@ -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