Installation
The History extension is included in the@tiptap/extensions package and is also part of the StarterKit.
Basic Usage
Included in StarterKit
The History extension is included by default when using StarterKit:Standalone Usage
Custom Configuration
Configuration Options
number
The amount of history events that are collected before the oldest events are discarded. This prevents the history from growing indefinitely.Default:
100number
The delay in milliseconds between changes after which a new history group should be started. Changes that occur within this delay are grouped together as a single undo/redo step.Default:
500Commands
command
Undo recent changes.Keyboard shortcuts:
Cmd/Ctrl + Z, Cmd/Ctrl + я (Russian layout)command
Reapply reverted changes.Keyboard shortcuts:
Cmd/Ctrl + Shift + ZCmd/Ctrl + YCmd/Ctrl + Shift + я(Russian layout)
Keyboard Shortcuts
Advanced Examples
Custom Undo/Redo Buttons
React Component with Undo/Redo
Shorter History Depth for Memory Efficiency
Faster Grouping for Rapid Edits
Disable History in StarterKit
If you want to use the Collaboration extension instead:Check if Undo/Redo is Available
Vue Component Example
How History Works
The History extension groups changes based on time. When you type continuously, all changes within thenewGroupDelay window are grouped together as a single undo step. This creates a natural editing experience:
- Typing continuously: All text entered within 500ms is one undo step
- Pausing then typing: Creates a new undo step
- Each formatting change: Usually a separate undo step
- Large operations: Typically a single undo step