Properties provide read-only access to SuperDoc’s internal state and subsystems.
Core Properties
superdocId
Unique identifier for this SuperDoc instanceconsole.log(superdoc.superdocId);
// "550e8400-e29b-41d4-a716-446655440000"
version
SuperDoc version numberconsole.log(superdoc.version);
// "2.1.0"
Editor Access
activeEditor
Currently active editor instanceAlways check for null before accessing
if (superdoc.activeEditor) {
// Direct ProseMirror access
superdoc.activeEditor.commands.toggleBold();
// Access state
const { doc, selection } = superdoc.activeEditor.state;
// Access view
superdoc.activeEditor.view.focus();
}
State Properties
Document State
Whether the document is locked
User who locked the document
Whether collaboration is enabled
Whether in development mode
if (superdoc.isLocked) {
console.log(`Locked by ${superdoc.lockedBy.name}`);
}
if (superdoc.isCollaborative) {
showCollaboratorsList();
}
User Properties
Current User
All Users
All users with document access
Available colors for awareness
superdoc.users.forEach(user => {
console.log(`${user.name} (${user.email})`);
});
Subsystem Access
Toolbar instance if configuredif (superdoc.toolbar) {
superdoc.toolbar.updateToolbarState();
}
Collaboration
provider
HocuspocusProvider | undefined
Collaboration provider for the SuperDoc level
Yjs document for collaboration
socket
HocuspocusProviderWebsocket | null
WebSocket connection
if (superdoc.provider) {
superdoc.provider.on('synced', () => {
console.log('Synced with server');
});
}
Store Access
Document Store
Pinia store for document managementconst documents = superdoc.superdocStore.documents;
documents.forEach(doc => {
console.log(doc.id, doc.type);
});
Pinia store for commentsconst comments = superdoc.commentsStore.comments;
console.log(`${comments.length} comments`);
High Contrast Store
Store for high contrast mode stateconst isHighContrast = superdoc.highContrastModeStore.isEnabled;
Internal Properties
These properties are for advanced use cases
Full configuration object
Property Usage
Properties are read-only. Use methods to modify state:// ❌ Don't modify directly
superdoc.isLocked = true;
superdoc.activeEditor = newEditor;
// ✅ Use methods
superdoc.lockSuperdoc(true);
superdoc.setActiveEditor(newEditor);
Common Patterns
Check Before Access
// Always check nullable properties
if (superdoc.activeEditor) {
superdoc.activeEditor.focus();
}
if (superdoc.toolbar) {
superdoc.toolbar.updateState();
}
Wait for Ready
Some properties only available after ready event
superdoc.once('ready', () => {
// Now safe to access
console.log(superdoc.activeEditor);
console.log(superdoc.toolbar);
});
Direct Editor Access
// Get ProseMirror state
const getSelection = () => {
if (!superdoc.activeEditor) return null;
const { from, to } = superdoc.activeEditor.state.selection;
return { from, to };
};
// Execute commands
const makeBold = () => {
superdoc.activeEditor?.commands.toggleBold();
};