Class

RevisionHistory (revision-history)

@ckeditor/ckeditor5-revision-history/src/revisionhistory

class

The revision history feature.

Enables tracking and bundling changes into revisions as well as provides the default UI for browsing revisions.

To learn more about the revision history feature refer to the Revision history guide.

Filtering

Properties

  • adapter : RevisionHistoryAdapter

    An adapter object that should communicate with the data source to fetch or save the revisions data.

Methods

  • addRevisionData( revisionData ) → Revision

    Creates a revision basing on given revision data and adds it to the revision tracker and revision repository.

    The parameter of this method should be an object with revision data. You can receive such an object by calling RevisionHistory#getRevisions( { toJSON: true )} or Revision#toJSON().

    // Get revisions data in an appropriate format.
    // You can save it in your database.
    const revisionsData = revisionHistory.getRevisions( { toJSON: true } );
    // ...
    // Use revisions data.
    // That revisions data might be loaded from your database.
    revisionsData.forEach( revisionData => revisionHistory.addRevisionData( revisionData ) );

    Parameters

    revisionData : Object

    Revision data.

    Returns

    Revision

    The created revision.

  • getRevision( revisionIdOrIndex ) → Revision | null

    Returns the revision with a given revision id or at a given index.

    Parameters

    revisionIdOrIndex : String | Number

    Returns

    Revision | null
  • getRevisions( [ options ] = { [options.toJSON] } ) → Array.<(Revision | Object)>

    Returns all revisions added to the repository.

    Parameters

    [ options ] : Object
    Properties
    [ options.toJSON ] : Boolean

    Return the data in JSON format.

    Defaults to false

    Returns

    Array.<(Revision | Object)>