mirror of
https://github.com/penpot/penpot.git
synced 2026-11-05 01:20:38 +00:00
🐛 Undo text edits from the Edit menu while editing
Edit > Undo and Redo emit the same events as the shortcuts, but the menu takes the focus. The blurred WASM editor then ignored the restore, so the menu did nothing while the text edition stayed open. Focus the editor again before restoring its history. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
5462012b4e
commit
1817871f51
@ -933,14 +933,17 @@
|
||||
|
||||
;; The workspace leaves undo to the active editor. Handle the same events
|
||||
;; for keyboard shortcuts, native history input and workspace menu actions.
|
||||
;; A menu takes the focus and blurs the WASM editor, which then ignores the
|
||||
;; restore: take the focus back first, as the edition is still open.
|
||||
(mf/use-effect
|
||||
(mf/deps)
|
||||
(mf/deps focus-editor!)
|
||||
(fn []
|
||||
(let [subscription
|
||||
(->> st/stream
|
||||
(rx/filter #(or (ptk/type? ::dwu/undo %) (ptk/type? ::dwu/redo %)))
|
||||
(rx/subs! (fn [event]
|
||||
(when-not (mf/ref-val composing-ref)
|
||||
(focus-editor!)
|
||||
(st/emit! (dwt/v3-restore-history
|
||||
(if (ptk/type? ::dwu/undo event) :undo :redo)))
|
||||
(reset-input-node (mf/ref-val contenteditable-ref))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user