Class

RevisionsRepository (revision-history)

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

class

Manages revisions list.

Filtering

Methods

  • addRevision( revision, [ index ] )

    Adds revision to the repository on a given index.

    Parameters

    revision : Revision

    The revision instance to add.

    [ index ] : Number

    Index on which the revision should be added. If not set, the revision will be added as the first revision.

    Defaults to 0

  • createRevision( revisionData ) → Revision

    Creates a revision instance from plain object with revision data.

    Parameters

    revisionData : Object

    The object with the revision data. Should be compatible with the format of the object returned by Revision#toJSON().

    Returns

    Revision
  • getIndex( revisionId ) → Number

    Returns the index of the revision with a given revision id.

    Parameters

    revisionId : String

    Returns

    Number
  • 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)>