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.

贡献者指南