Undo/Redo extension

VersionDownloads

This extension provides undo and redo support. All changes to the document will be tracked and can be removed with undo. Undone changes can be applied with redo again.

You should only integrate this extension if you don't plan to make your editor collaborative. The Collaboration extension has its own undo/redo support because people generally don't want to revert changes made by others.

Install

npm install @tiptap/extension-history

Settings

depth

The amount of history events that are collected before the oldest events are discarded.

Default: 100

History.configure({
  depth: 10,
})

newGroupDelay

The delay between changes after which a new group should be started (in milliseconds). When changes aren’t adjacent, a new group is always started.

Default: 500

History.configure({
  newGroupDelay: 1000,
})

Commands

undo()

Undo the last change.

editor.commands.undo()

redo()

Redo the last change.

editor.commands.redo()

Keyboard shortcuts

CommandWindows/LinuxmacOS
undo()Control + Z or Control + яCmd + Z + or Cmd + я
redo()Shift + Control + Z or Control + Y or Shift + Control + яShift + Cmd + Z or Cmd + Y or Shift + Cmd + я

Source code

packages/extension-history/