| hidden | true |
|---|---|
| title | Extensions API |
| sidebarTitle | Overview |
Extensions are the building blocks of SuperDoc. Every feature—from bold text to track changes—comes from an extension.
Extensions provide:
- Commands - Actions like
toggleBold()orinsertTable() - Schema - Define what can exist in documents
- Behavior - Keyboard shortcuts, input rules, events
You don't typically configure extensions directly. SuperDoc handles it:
```javascript Usage // These commands come from extensions editor.commands.toggleBold(); // Bold extension editor.commands.insertTable(); // Table extension editor.commands.acceptAllTrackedChanges(); // TrackChanges extension ```import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
const superdoc = new SuperDoc({
selector: '#editor',
document: yourFile,
onReady: (superdoc) => {
const editor = superdoc.activeEditor;
// These commands come from extensions
editor.commands.toggleBold(); // Bold extension
editor.commands.insertTable(); // Table extension
editor.commands.acceptAllTrackedChanges(); // TrackChanges extension
},
});Basic document capabilities:
- Bold, Italic, Underline, Strike- Text formatting
- Strike, Heading - Document structure
- Lists, Tables - Bullet points and tables
Complex functionality:
- Track Changes - Revision tracking
- Comments - Discussions
- Field Annotation - Form fields
- Document Section - Locked sections
- Table - Complex tables
- Search - Find and replace
- Registration - Extensions load with the editor
- Schema definition - Define nodes/marks
- Command registration - Add to
editor.commands - Event handling - React to changes