ueberdosis/tiptap

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

クローズ

#6,663 opened on 2025/07/16

 (2 件のコメント) (0 件のリアクション) (1 人の担当者)TypeScript (1,979 件のフォーク)batch import
area: corecomplexity: easygood first issueimpact: medium

Repository metrics

Stars
 (23,454 個のスター)
PR merge metrics
 (平均マージ 4d 13h) (30d で 46 merged PRs)

説明

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.

コントリビューターガイド