IVersionHistory
9 Jul 20263 minutes to read
Defines the public API for managing version history snapshots
within the collaborative BlockEditor.
Methods
createSnapshot
Creates a new snapshot of the current editor state.
The snapshot stores the current collaborative document state
along with optional metadata such as label and author details.
| Parameter | Type | Description |
|---|---|---|
| options (optional) | SnapshotOptions |
Snapshot creation options. |
Returns Promise
deleteSnapshot
Deletes an existing snapshot permanently.
| Parameter | Type | Description |
|---|---|---|
| snapshotId | string |
ID of the snapshot to delete. |
Returns Promise
exportSnapshot
Exports a snapshot into a serializable object.
The exported object can later be imported into another editor
instance or persisted externally.
| Parameter | Type | Description |
|---|---|---|
| snapshotId | string |
ID of the snapshot to export. |
Returns ExportedVersion | null
getSnapshots
Returns all snapshots ordered from newest to oldest.
Supports pagination for large version histories.
| Parameter | Type | Description |
|---|---|---|
| limit (optional) | number |
Maximum number of results to return. |
| offset (optional) | number |
Number of results to skip from the start. |
Returns VersionSnapshot[]
importSnapshot
Imports a previously exported snapshot into the editor’s
version history storage.
| Parameter | Type | Description |
|---|---|---|
| exported | ExportedVersion |
Exported snapshot object. |
Returns Promise
pruneVersions
Removes old snapshots using the configured retention strategy.
The pruning process keeps recent and meaningful snapshots
while removing outdated snapshots automatically.
Returns Promise
renameSnapshot
Renames an existing snapshot.
Only snapshot metadata is updated. The stored document state
remains unchanged.
| Parameter | Type | Description |
|---|---|---|
| snapshotId | string |
ID of the snapshot to rename. |
| newLabel | string |
Updated snapshot label. |
Returns Promise
restoreSnapshot
Restores the editor content from an existing snapshot.
This replaces the current collaborative document state
with the snapshot’s stored state.
| Parameter | Type | Description |
|---|---|---|
| snapshotId | string |
ID of the snapshot to restore. |
Returns Promise