mirror of
https://github.com/penpot/penpot.git
synced 2025-05-22 04:16:10 +02:00
🐛 Improve behavior for undo on text edition
This commit is contained in:
parent
36583d1171
commit
b5be938480
7 changed files with 41 additions and 23 deletions
|
@ -55,9 +55,8 @@
|
|||
|
||||
(defn update-shapes
|
||||
([ids update-fn] (update-shapes ids update-fn nil))
|
||||
([ids update-fn {:keys [reg-objects? save-undo? attrs ignore-tree page-id]
|
||||
:or {reg-objects? false save-undo? true}}]
|
||||
|
||||
([ids update-fn {:keys [reg-objects? save-undo? stack-undo? attrs ignore-tree page-id]
|
||||
:or {reg-objects? false save-undo? true stack-undo? false}}]
|
||||
(us/assert ::coll-of-uuid ids)
|
||||
(us/assert fn? update-fn)
|
||||
|
||||
|
@ -80,6 +79,7 @@
|
|||
(pcb/update-shapes changes [id] update-fn opts)))
|
||||
(-> (pcb/empty-changes it page-id)
|
||||
(pcb/set-save-undo? save-undo?)
|
||||
(pcb/set-stack-undo? stack-undo?)
|
||||
(pcb/with-objects objects))
|
||||
ids)
|
||||
changes (add-group-id changes state)]
|
||||
|
@ -165,8 +165,8 @@
|
|||
|
||||
(defn commit-changes
|
||||
[{:keys [redo-changes undo-changes
|
||||
origin save-undo? file-id group-id]
|
||||
:or {save-undo? true}}]
|
||||
origin save-undo? file-id group-id stack-undo?]
|
||||
:or {save-undo? true stack-undo? false}}]
|
||||
(log/debug :msg "commit-changes"
|
||||
:js/redo-changes redo-changes
|
||||
:js/undo-changes undo-changes)
|
||||
|
@ -183,6 +183,7 @@
|
|||
:page-id page-id
|
||||
:frames frames
|
||||
:save-undo? save-undo?
|
||||
:stack-undo? stack-undo?
|
||||
:group-id group-id})
|
||||
|
||||
ptk/UpdateEvent
|
||||
|
@ -233,4 +234,4 @@
|
|||
(let [entry {:undo-changes undo-changes
|
||||
:redo-changes redo-changes
|
||||
:group-id group-id}]
|
||||
(rx/of (dwu/append-undo entry)))))))))))
|
||||
(rx/of (dwu/append-undo entry stack-undo?)))))))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue