RevisionHistory (revision-history)
@ckeditor/ckeditor5-revision-history/src/revisionhistory
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
module:revision-history/revisionhistory~RevisionHistory#adapter
An adapter object that should communicate with the data source to fetch or save the revisions data.
Methods
-
addRevisionData( revisionData ) → Revision
module:revision-history/revisionhistory~RevisionHistory#addRevisionData
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
)} orRevision#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
module:revision-history/revisionhistory~RevisionHistory#getRevision
Returns the revision with a given revision id or at a given index.
-
getRevisions( [ options ] = { [options.toJSON] } ) → Array.<(Revision | Object)>
module:revision-history/revisionhistory~RevisionHistory#getRevisions
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)>
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.