Configuration & Methods
Version history only works in collaboration mode (collaboration must be enabled and connected to the server successfully). See Collaboration.
Default configuration
const defaultOptions = {
collaboration: {
enabled: true,
// ...
},
versions: {
enabled: true,
diffUseUserColor: false,
diffLabelEnabled: true,
diffLabelTemplate: 'By "{name}" {action}',
diffIgnoreMarks: ['inlineThread'],
diffIgnoreAttributes: ['id', 'data-thread-id'],
diffExcludeNodeViews: [],
}
}Options
versions.enabled
Description: Enable or disable version history. When disabled, the Version History panel is hidden and version interactions do not work.
Type: Boolean
Default: true
versions.diffUseUserColor
Description: Whether to use user color (options.user.color) to highlight differences during version comparison.
Type: Boolean
Default: false
versions.diffLabelEnabled
Description: Show “diff labels” in version comparison to help readers understand the source of changes.
Type: Boolean
Default: true
versions.diffLabelTemplate
Description: Diff label template (copy customization for the comparison UI).
Type: String
Default: By "{name}" {action}
Placeholders:
{name}: creator display name{action}: action description (for example: add/delete/update)
versions.diffIgnoreMarks
Description: Mark types to ignore during version comparison. Common use: ignore comments/annotations to reduce noise.
Type: String[]
Default: ['inlineThread']
versions.diffIgnoreAttributes
Description: Attribute keys to ignore during version comparison. Common use: ignore node ids and other non-content attributes to reduce noise.
Type: String[]
Default: ['id', 'data-thread-id']
versions.diffExcludeNodeViews
Description: NodeView names to exclude when rendering version comparison/preview (configured by node name). Common use: some complex nodes (for example, tables) may depend on the host runtime in read-only previews and can cause rendering or diff misalignment. Excluding their NodeViews makes the preview fall back to basic DOM serialization output.
Type: String[]
Default: []
Methods
These methods are exposed by the editor component (call via ref). They require versions.enabled !== false and a healthy collaboration connection.
openVersions
Description: Open the document history panel.
Parameters: None
Returns: None
closeVersions
Description: Close the document history panel.
Parameters: None
Returns: None
getVersions
Description: Get the version list (for custom rendering or business display).
Returns: Array (version records; fields depend on actual returned data)
Note: Version records may include an important field for “Important” versions (see Getting Started).
getCurrentVersion
Description: Get current version info and document content.
Parameters: None
Returns: Object
getVersion
Description: Get the specified version info and document content.
Parameters:
version:Number, version number.
Returns: Object
saveVersion
Description: Create a new version.
Parameters:
name:String, version name.
Returns: Boolean (whether the request was initiated successfully)
clearVersions
Description: Clear all versions and reset the current version number (use with caution; suitable for admin/debug scenarios).
Returns: Boolean