♻️ Convert text-editor-html and text-editor to * suffix in v2-editor

This commit is contained in:
Andrey Antukh 2026-04-02 21:40:07 +00:00
parent b784dbf074
commit 2e380f395c
3 changed files with 21 additions and 23 deletions

View File

@ -234,11 +234,10 @@
(get-contrast-color background-color)))
(get-contrast-color background-color)))
(mf/defc text-editor-html
(mf/defc text-editor-html*
"Text editor (HTML)"
{::mf/wrap [mf/memo]
::mf/props :obj}
[{:keys [shape canvas-ref render-wasm?] :or {render-wasm? false}}]
{::mf/wrap [mf/memo]}
[{:keys [shape canvas-ref is-render-wasm] :or {is-render-wasm false}}]
(let [content (:content shape)
shape-id (dm/get-prop shape :id)
fill-color (get-color-from-content content)
@ -258,7 +257,7 @@
:background-color background-color}) color/black)
[align-top? align-center? align-bottom?]
(vertical-align-editor-classes content render-wasm?)
(vertical-align-editor-classes content is-render-wasm)
fonts
(-> (mf/use-memo (mf/deps content) #(get-fonts content))
@ -336,12 +335,11 @@
;; Text Editor Wrapper
;; This is an SVG element that wraps the HTML editor.
;;
(mf/defc text-editor
(mf/defc text-editor*
"Text editor wrapper component"
{::mf/wrap [mf/memo]
::mf/props :obj
::mf/forward-ref true}
[{:keys [shape modifiers canvas-ref] :as props} _]
[{:keys [shape modifiers canvas-ref]} _]
(let [shape-id (dm/get-prop shape :id)
modifiers (dm/get-in modifiers [shape-id :modifiers])
@ -455,7 +453,7 @@
[:foreignObject {:x x :y y :width width :height height}
[:div {:style style}
[:& text-editor-html {:shape shape
:canvas-ref canvas-ref
:render-wasm? render-wasm?
:key (dm/str shape-id)}]]]]))
[:> text-editor-html* {:shape shape
:canvas-ref canvas-ref
:is-render-wasm render-wasm?
:key (dm/str shape-id)}]]]]))

View File

@ -439,9 +439,9 @@
[:g {:style {:pointer-events (if disable-events? "none" "auto")}}
(when show-text-editor?
(if (features/active-feature? @st/state "text-editor/v2")
[:& editor-v2/text-editor {:shape editing-shape
:canvas-ref canvas-ref
:modifiers modifiers}]
[:> editor-v2/text-editor* {:shape editing-shape
:canvas-ref canvas-ref
:modifiers modifiers}]
[:& editor-v1/text-editor-svg {:shape editing-shape
:modifiers modifiers}]))
@ -621,7 +621,7 @@
:on-click add-variant}])
(when show-presence?
[:& presence/active-cursors
[:> presence/active-cursors*
{:page-id page-id}])
(when-not hide-ui?
@ -704,7 +704,7 @@
[:g.grid-layout-editor {:clipPath "url(#clip-handlers)"}
(when (or show-grid-editor? hover-grid?)
[:& grid-layout/editor
[:> grid-layout/editor*
{:zoom zoom
:objects base-objects
:modifiers modifiers
@ -717,7 +717,7 @@
(empty? (:shapes frame))
(not= edition (:id frame))
(not= @hover-top-frame-id (:id frame)))
[:& grid-layout/editor
[:> grid-layout/editor*
{:zoom zoom
:key (dm/str (:id frame))
:objects base-objects

View File

@ -519,9 +519,9 @@
:ref text-editor-ref}]
(features/active-feature? @st/state "text-editor/v2")
[:& editor-v2/text-editor {:shape editing-shape
:canvas-ref canvas-ref
:ref text-editor-ref}]
[:> editor-v2/text-editor* {:shape editing-shape
:canvas-ref canvas-ref
:ref text-editor-ref}]
:else [:& editor-v1/text-editor-svg {:shape editing-shape
:ref text-editor-ref}]))
@ -675,7 +675,7 @@
:zoom zoom}])
(when show-presence?
[:& presence/active-cursors
[:> presence/active-cursors*
{:page-id page-id}])
(when-not hide-ui?
@ -769,7 +769,7 @@
[:g.grid-layout-editor {:clipPath "url(#clip-handlers)"}
(when show-grid-editor?
[:& grid-layout/editor
[:> grid-layout/editor*
{:zoom zoom
:objects objects-modified
:shape (or (get objects-modified edition)