mirror of
https://github.com/penpot/penpot.git
synced 2025-05-24 18:06:12 +02:00
🐛 Fix text editor enter behaviour with centered texts
This commit is contained in:
parent
5a8ce52105
commit
efd2ad8f8b
3 changed files with 6 additions and 7 deletions
|
@ -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]
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue