mirror of
https://github.com/penpot/penpot.git
synced 2026-03-14 06:17:25 +00:00
🐛 Fix problem with autogrow change while editing text
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user