Every extension
history
Undo and redo as commands, for toolbars.
The engine keeps the stack and binds the keys; these just reach it. The commands return false when there is nothing to rewind, so a button can disable itself.
Adding it
import { createEditor, document, paragraph, text, history } from '@matrajs/core'
const editor = createEditor({
extensions: [document, paragraph, text, history],
element: document.querySelector('#editor'),
})
There is no separate package · history is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.
Commands
-
editor.commands.undo() -
editor.commands.redo()