From 1817871f51042b7564799db877029d8ac122c729 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 3 Nov 2026 17:37:37 +0100 Subject: [PATCH] :bug: 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 --- .../src/app/main/ui/workspace/shapes/text/v3_editor.cljs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs index 81df3f1421..48846b1aab 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/v3_editor.cljs @@ -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))