Overview
The History plugin provides unlimited undo/redo capabilities and revision history tracking. View all changes made to a document, compare versions, and restore to any previous state with full change attribution.
Features
- ✓ Unlimited undo/redo
- ✓ Revision history
- ✓ Version comparison
- ✓ Change tracking
- ✓ User attribution
- ✓ Timestamps
- ✓ Restore previous versions
- ✓ History export
Installation
npm install @editora/plugin-history
Basic Usage
import Editora from '@editora/core';
import HistoryPlugin from '@editora/plugin-history';
const editor = new Editora('#editor');
editor.use(HistoryPlugin, {
maxHistorySteps: 100
});
// Undo last change
editor.execCommand('undo');
Revision Management
Manage document history:
- View History: Open history panel to see all changes
- Compare: Side-by-side version comparison
- Restore: Revert to any previous version
- Export: Save history as log file
Configuration Options
| Option | Type | Description |
|---|---|---|
| maxHistorySteps | number | Maximum history entries to keep (default: 100) |
| trackChanges | boolean | Enable change tracking (default: true) |
API Methods
- undo(): Undo last change
- redo(): Redo last undone change
- getHistory(): Get full revision history
- restoreVersion(version): Restore to specific version