diff --git a/CHANGES.md b/CHANGES.md index f66fc83d6..37bbb5cd3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ - Fix undo problem when changing typography/color from library [#1230](https://github.com/penpot/penpot/issues/1230) - Fix problem with text margin while rendering [#1231](https://github.com/penpot/penpot/issues/1231) - Fix problem with masked texts on exporting [Taiga #2116](https://tree.taiga.io/project/penpot/issue/2116) +- Fix text editor enter behaviour with centered texts [Taiga #2126](https://tree.taiga.io/project/penpot/issue/2126) ### :arrow_up: Deps updates ### :boom: Breaking changes diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index 841bf0181..53e123c16 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -180,12 +180,10 @@ shape (get objects id) merge-fn (fn [node attrs] - (reduce-kv (fn [node k v] - (if (= (get node k) v) - (dissoc node k) - (assoc node k v))) - node - attrs)) + (reduce-kv + (fn [node k v] (assoc node k v)) + node + attrs)) update-fn #(update-shape % txt/is-paragraph-node? merge-fn attrs) shape-ids (cond (= (:type shape) :text) [id] diff --git a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs index db9d70aad..d00ea37bd 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs @@ -174,7 +174,7 @@ handle-return (mf/use-callback (fn [_ state] - (let [style (ted/get-editor-current-inline-styles state) + (let [style (ted/get-editor-current-block-data state) state (-> (ted/insert-text state "\n" style) (handle-change))] (st/emit! (dwt/update-editor-state shape state)))