mirror of
https://github.com/penpot/penpot.git
synced 2026-09-07 04:29:31 +00:00
Merge pull request #9614 from penpot/elenatorro-fix-text-focus-on-empty-text-shape
🐛 Fix text focus on empty text
This commit is contained in:
commit
009d805394
@ -290,8 +290,8 @@
|
|||||||
:data-testid "text-editor-container"
|
:data-testid "text-editor-container"
|
||||||
:style {:width "var(--editor-container-width)"
|
:style {:width "var(--editor-container-width)"
|
||||||
:height "var(--editor-container-height)"
|
:height "var(--editor-container-height)"
|
||||||
:min-width "1px"
|
:min-width "var(--editor-container-min-width, 1px)"
|
||||||
:min-height "1px"}}
|
:min-height "var(--editor-container-min-height, 1px)"}}
|
||||||
;; We hide the editor when is blurred because otherwise the
|
;; We hide the editor when is blurred because otherwise the
|
||||||
;; selection won't let us see the underlying text. Use opacity
|
;; selection won't let us see the underlying text. Use opacity
|
||||||
;; because display or visibility won't allow to recover focus
|
;; because display or visibility won't allow to recover focus
|
||||||
@ -381,7 +381,7 @@
|
|||||||
|
|
||||||
render-wasm? (mf/use-memo #(features/active-feature? @st/state "render-wasm/v1"))
|
render-wasm? (mf/use-memo #(features/active-feature? @st/state "render-wasm/v1"))
|
||||||
|
|
||||||
[{:keys [x y width height]} transform]
|
[{:keys [x y width height selrect-width selrect-height]} transform]
|
||||||
(if render-wasm?
|
(if render-wasm?
|
||||||
(let [{:keys [width height]} (wasm.api/get-text-dimensions shape-id)
|
(let [{:keys [width height]} (wasm.api/get-text-dimensions shape-id)
|
||||||
selrect-transform (mf/deref refs/workspace-selrect)
|
selrect-transform (mf/deref refs/workspace-selrect)
|
||||||
@ -403,7 +403,8 @@
|
|||||||
"bottom" (+ y (- selrect-height height))
|
"bottom" (+ y (- selrect-height height))
|
||||||
"center" (+ y (/ (- selrect-height height) 2))
|
"center" (+ y (/ (- selrect-height height) 2))
|
||||||
y)]
|
y)]
|
||||||
[(assoc selrect :y y :width overlay-width :height max-height) transform])
|
[(assoc selrect :y y :width overlay-width :height max-height
|
||||||
|
:selrect-width selrect-width :selrect-height selrect-height) transform])
|
||||||
|
|
||||||
(let [bounds (gst/shape->rect shape)
|
(let [bounds (gst/shape->rect shape)
|
||||||
x (mth/min (dm/get-prop bounds :x)
|
x (mth/min (dm/get-prop bounds :x)
|
||||||
@ -422,6 +423,8 @@
|
|||||||
(obj/merge!
|
(obj/merge!
|
||||||
#js {"--editor-container-width" "auto"
|
#js {"--editor-container-width" "auto"
|
||||||
"--editor-container-height" "auto"
|
"--editor-container-height" "auto"
|
||||||
|
"--editor-container-min-width" (dm/str selrect-width "px")
|
||||||
|
"--editor-container-min-height" (dm/str selrect-height "px")
|
||||||
"--fallback-families" (if (seq fallback-families) (dm/str (str/join ", " fallback-families)) "sourcesanspro")
|
"--fallback-families" (if (seq fallback-families) (dm/str (str/join ", " fallback-families)) "sourcesanspro")
|
||||||
:display "flex"})
|
:display "flex"})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user