Skip to content

plugin-history

This plugin provides undo and redo capabilities using two new commands.

Installation

npm i @chamaeleon/plugin-history

Usage

import { History } from '@chamaeleon/plugin-history';
const editor = new Editor({
plugins: [History()],
});

By default, the history limit is 1000 commands, you can configure the plugin to increase or decrease this limit

import { History } from '@chamaeleon/plugin-history';
const editor = new Editor({
plugins: [History({ limit: 100 })],
});
const Example = () => {
const editor = useEditor();
return (
<>
<button onClick={() => editor.commands.undo()}>Undo</button>
<button onClick={() => editor.commands.redo()}>Redo</button>
</>
);
};