SuperEditor configuration gives you low-level control over the DOCX engine.
Quick Start
new SuperEditor({
selector: '#editor',
fileSource: docxFile,
documentId: 'doc-123',
options: { /* configuration */ }
})
Core Parameters
selector
string | HTMLElement
required
DOM selector or element where the editor will mountselector: '#editor'
// or
selector: document.querySelector('.my-editor')
fileSource
File | Blob | string | ArrayBuffer
required
The DOCX file to load
File
- From file input
Blob
- From fetch response
string
- URL to download or base64 encoded
ArrayBuffer
- Raw binary data
Unique identifier for this document instance. Used for collaboration and storage.
Configuration options object
Options Configuration
Modes & Permissions
Editor rendering mode
docx
- Full DOCX features
text
- Plain text mode
html
- HTML mode
options.documentMode
string
default:"'editing'"
Current editing state
editing
- Full editing capabilities
viewing
- Read-only mode
suggesting
- Track changes enabled
User permission level. Overrides documentMode when more restrictive.Role always wins over documentMode in permission conflicts
Whether the editor accepts input
User & Collaboration
All users with document access. Used for @mentions and awareness.
Yjs document for real-time collaboration
options.collaborationProvider
Provider instance for collaboration sync
Content Initialization
options.content
string | Object
default:"''"
XML content string or JSON for initialization
Initialize with HTML content (overrides DOCX)
Initialize with Markdown (converts to document)
Use JSON content instead of DOCX parsingSee full JSON schema here.
Load content directly from schema JSON
Whether this is a newly created document
Extensions & Plugins
options.extensions
Array<Extension>
default:"[]"
SuperDoc extensions to loadDefault extensions include all DOCX features.
options.externalExtensions
Array<Extension>
default:"[]"
Additional external extensions to register
Learn how to create your own extensions
here.
Direct ProseMirror EditorProps configuration
ProseMirror parse options
options.coreExtensionOptions
Options for built-in extensions
Enable input rules (auto-formatting)
Features
Whether this is a header/footer editor
Whether this is a child editor instance
Styling
options.colors
Array<string>
default:"[]"
Available colors for highlighting and formatting
Font configuration and embedded fonts
options.suppressDefaultDocxStyles
Prevent default DOCX styles from being applied
Advanced Options
Run without DOM (server-side processing)
options.handleImageUpload
Custom image upload handlerhandleImageUpload: async (file) => {
const url = await uploadToS3(file);
return url;
}
Pre-configured converter instance
Initial ProseMirror state
Telemetry configuration for usage tracking
List numbering configuration
Configuration Patterns
Headless Processing
new SuperEditor({
selector: document.createElement('div'),
fileSource: docxBlob,
documentId: 'processing',
options: {
isHeadless: true,
onCreate: ({ editor }) => {
const html = editor.getHTML();
// Process document...
editor.destroy();
}
}
})
Custom Collaboration
new SuperEditor({
selector: '#editor',
fileSource: docxFile,
documentId: roomId,
options: {
ydoc: new Y.Doc(),
collaborationProvider: new HocuspocusProvider({
url: 'wss://collab.example.com',
name: roomId
}),
user: currentUser,
users: roomUsers
}
})
Track Changes Mode
new SuperEditor({
selector: '#editor',
fileSource: docxFile,
documentId: 'review-doc',
options: {
documentMode: 'suggesting',
user: reviewer,
onCreate: ({ editor }) => {
editor.commands.enableTrackChanges();
}
}
})
Custom Extensions
new SuperEditor({
selector: '#editor',
fileSource: docxFile,
documentId: 'doc-123',
options: {
extensions: [
Bold.configure({ HTMLAttributes: { class: 'custom-bold' } }),
MyCustomExtension
],
editorProps: {
attributes: {
class: 'prose max-w-none'
}
}
}
})