Properties provide read-only access to SuperDoc’s internal state and subsystems.

Core Properties

superdocId

superdocId
string
Unique identifier for this SuperDoc instance
console.log(superdoc.superdocId);
// "550e8400-e29b-41d4-a716-446655440000"

version

version
string
SuperDoc version number
console.log(superdoc.version);
// "2.1.0"

Editor Access

activeEditor

activeEditor
Editor | null
Currently active editor instance
Always 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

isLocked
boolean
Whether the document is locked
lockedBy
User | null
User who locked the document
isCollaborative
boolean
Whether collaboration is enabled
isDev
boolean
Whether in development mode
if (superdoc.isLocked) {
  console.log(`Locked by ${superdoc.lockedBy.name}`);
}

if (superdoc.isCollaborative) {
  showCollaboratorsList();
}

User Properties

Current User

user
User
Current user information

All Users

users
User[]
All users with document access
colors
string[]
Available colors for awareness
superdoc.users.forEach(user => {
  console.log(`${user.name} (${user.email})`);
});

Subsystem Access

Toolbar

toolbar
SuperToolbar | null
Toolbar instance if configured
if (superdoc.toolbar) {
  superdoc.toolbar.updateToolbarState();
}

Collaboration

provider
HocuspocusProvider | undefined
Collaboration provider for the SuperDoc level
ydoc
Y.Doc | undefined
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

superdocStore
Object
Pinia store for document management
const documents = superdoc.superdocStore.documents;
documents.forEach(doc => {
  console.log(doc.id, doc.type);
});

Comments Store

commentsStore
Object
Pinia store for comments
const comments = superdoc.commentsStore.comments;
console.log(`${comments.length} comments`);

High Contrast Store

highContrastModeStore
Object
Store for high contrast mode state
const isHighContrast = superdoc.highContrastModeStore.isEnabled;

Internal Properties

These properties are for advanced use cases
config
Object
Full configuration object
app
Vue.App
Vue application instance
pinia
Pinia
Pinia store instance
commentsList
SuperComments | null
Comments list component

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();
};