From f60a4cd11128856b467a55ce45831699df095541 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 13 Feb 2026 10:50:00 +0100 Subject: [PATCH] :bug: Fix problem with autogrow change while editing text --- frontend/src/app/main/data/workspace/texts.cljs | 13 +++++-------- .../workspace/sidebar/options/menus/text.cljs | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index 34a5a57328..8874115443 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -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 diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs index 04e05ae53f..3135a815bc 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs @@ -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)))