ueberdosis/tiptap

editor.commands.undo() and redo() do nothing unless the editor is focused

已關閉

#6,663 建立於 2025年7月16日

 (2 則留言) (0 個反應) (1 位負責人)TypeScript (1,979 個分叉)batch import
area: corecomplexity: easygood first issueimpact: medium

倉庫指標

星標
 (23,454 顆星)
PR 合併指標
 (平均合併 4天 13小時) (30 天內合併 46 個 PR)

描述

Affected Packages

all

Version(s)

3.0

Bug Description

While building a custom toolbar using TipTap v3, I found that calling editor.commands.undo() or editor.commands.redo() doesn't trigger the expected behavior unless I call .focus() first. This is not mentioned in the docs and leads to confusing behavior when using toolbar buttons outside the editor context.

Initialize TipTap editor with StarterKit and History

Add custom buttons calling:

editor.commands.undo(); // or editor.commands.redo() Make any change (e.g., type "Hello") Click the Undo button:❌ Nothing happens

after trying: editor.chain().focus().undo().run(); ✅ Works immediately

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

Undo/Redo should work regardless of whether the editor is currently focused, especially when triggered via UI buttons like a floating or fixed toolbar.

editor.commands.undo() or redo() do nothing unless editor is focused .chain().focus().undo().run() works as expected

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.

貢獻者指南