Netlify Create /

Version control

When a content source module supports version control, the visual editor provides the ability to view and restore previous versions of a document.

# View & restore versions

When version control is enabled, the document editor displays a list of versions for the document.

version control - version list

Clicking on a version in the list populates the fields for that version of the document. Clicking Restore when viewing a version restores the document to that version.

version control - view previous version

Note the following from the image above:

  1. Fields that are different from the current version are highlighted in blue.
  2. The version can be restored or the editor can be closed without restoring the version by using the Restore and Don't restore buttons.
  3. Switch to other versions by opening the versions list.

# Restore a version

When a version is restored, the document is updated with the values from that version.

The updated list of versions is then again retrieved using the getDocumentVersions method. The affect of restoring a version on the list of versions is determined by the implementation of the getDocumentVersions method, which is dependent upon the capabilities of the content source.

# Supported content sources

This feature is supported in the following content sources:

# Implement version control

When implementing a custom CSI module, version control is enabled when the getDocumentVersions method is implemented.

# Retrieve versions

When a document is active in a relevant editing context, the getDocumentVersions method is called to retrieve the list of versions for the document.

Some content sources may not provide the ability to attach a document object to each version without additional API requests. In these cases, it is not necessary to populate the document object.

# Display a version

When a previous version is previewed, if the document object was attached to that version in the getDocumentVersions response, the document object is used to populate the field values in the editor.

If the document object was not attached to the version, the getDocumentForVersion method is called to retrieve the document for the selected.

# References