Docs › Saving and output
Revisions
Versions kept every minute while writing; compare and restore.
While you write, the editor keeps earlier states of the post as versions. The revisions button lists them, shows what changed against the current text, and restores the one you pick. Use it when undo would have to go back too far.
Try it
Edit this sentence, wait about five seconds, and edit it again. Then press the revisions button.
Code for this demo
createEditor('#editor', {
toolbar: 'heading | bold italic | bulletList | revisions',
revisions: { key: 'docs-revisions-demo', interval: 5000 },
});Behavior
- Every
interval(default one minute), and when the editor loses focus, it checks for changes. If there are any, the state before them is kept as a version. - Only the latest
maxversions (default 20) are kept. - The list shows time and length. Picking one shows, word by word, what was deleted since (struck through) and what was added (underlined).
- Restore this version is an ordinary undoable change: Ctrl+Z brings the text back.
Where versions live
With only the revisions toolbar item, versions last for this page view (gone on reload). With revisions: true or an object, they are stored in localStorage under e82:rev: + key and survive a reload; without key the page path is used.
createEditor('#editor', {
toolbar: 'board', // board and full have it under the ⋯ menu
revisions: { key: 'post-' + postId, max: 30 },
});The toolbar item is revisions. It sits in the ⋯ menu of the board (default) and full presets, not in minimal or basic.
Options
| Name | Type | Default | Description |
|---|---|---|---|
revisions | toolbar item | - | Opens the revisions dialog |
revisions | boolean | object | this page view | true or an object stores versions in localStorage |
revisions.key | string | page path | Storage key (after e82:rev:) |
revisions.max | number | 20 | Versions kept |
revisions.interval | number | 60000 | Milliseconds between checks |