🐛 Fix problem with autogrow change while editing text

This commit is contained in:
alonso.torres
2026-02-13 10:50:00 +01:00
parent d9d4a99e1d
commit f60a4cd111
2 changed files with 17 additions and 13 deletions

View File

@@ -950,14 +950,11 @@
new-shape))
{:save-undo? save-undo? :undo-group (when new-shape? id)})
(if (and (not= :fixed (:grow-type shape)) finalize?)
(dwm/apply-wasm-modifiers
(dwwt/resize-wasm-text-modifiers shape content)
{:undo-group (when new-shape? id)})
(dwm/set-wasm-modifiers
(dwwt/resize-wasm-text-modifiers shape content)
{:undo-group (when new-shape? id)})))
(let [modifiers (dwwt/resize-wasm-text-modifiers shape content)
options {:undo-group (when new-shape? id)}]
(if (and (not= :fixed (:grow-type shape)) finalize?)
(dwm/apply-wasm-modifiers modifiers options)
(dwm/set-wasm-modifiers modifiers options))))
(when finalize?
(rx/concat

View File

@@ -30,6 +30,7 @@
typography-entry]]
[app.util.dom :as dom]
[app.util.i18n :as i18n :refer [tr]]
[app.util.text.content :as content]
[app.util.text.ui :as txu]
[app.util.timers :as ts]
[beicon.v2.core :as rx]
@@ -128,15 +129,21 @@
[{:keys [ids values on-blur] :as props}]
(let [grow-type (:grow-type values)
editor-instance (mf/deref refs/workspace-editor)
handle-change-grow
(mf/use-fn
(mf/deps ids on-blur)
(mf/deps ids on-blur editor-instance)
(fn [value]
(on-blur)
(let [uid (js/Symbol)
grow-type (keyword value)]
(st/emit!
(dwu/start-undo-transaction uid)
(dwsh/update-shapes ids #(assoc % :grow-type grow-type)))
grow-type (keyword value)
content (when editor-instance
(content/dom->cljs (dwt/get-editor-root editor-instance)))]
(st/emit! (dwu/start-undo-transaction uid))
(when (some? content)
(st/emit! (dwt/v2-update-text-shape-content (first ids) content :finalize? true)))
(st/emit! (dwsh/update-shapes ids #(assoc % :grow-type grow-type)))
(when (features/active-feature? @st/state "render-wasm/v1")
(st/emit! (dwwt/resize-wasm-text-all ids)))