Track Changes allows you to keep a record of changes or edits made to a document. You can then choose to accept or reject the modifications. It is a useful tool for managing changes made by several reviewers to the same document. If track changes option is enabled, all editing operations are preserved as revisions in Document Editor.
The following example demonstrates how to enable track changes.
let container: DocumentEditorContainer = new DocumentEditorContainer({ enableTrackChanges: true });
container.appendTo('#container');
The following example demonstrate how to get all tracked revision from current document.
let container: DocumentEditorContainer = new DocumentEditorContainer({ enableTrackChanges: true });
container.appendTo('#container');
/**
* Get revisions from the current document
*/
let revisions : RevisionCollection = container.documentEditor.revisions;
The following example demonstrates how to accept/reject all changes.
let container: DocumentEditorContainer = new DocumentEditorContainer({ enableTrackChanges: true });
container.appendTo('#container');
/**
* Get revisions from the current document
*/
let revisions : RevisionCollection = container.documentEditor.revisions;
/**
* Accept all tracked changes
*/
revisions.acceptAll();
/**
* Reject all tracked changes
*/
revisions.rejectAll();
The following example demonstrates how to accept/reject specific revision in the document editor.
/**
* Get revisions from the current document
*/
let revisions : RevisionCollection = container.documentEditor.revisions;
/**
* Accept specific changes
*/
revisions.get(0).accept();
/**
* Reject specific changes
*/
revisions.get(1).reject();
The following example demonstrates how to navigate tracked revision programmatically.
let container: DocumentEditorContainer = new DocumentEditorContainer({ enableTrackChanges: true });
container.appendTo('#container');
/**
* Navigate to next tracked change from the current selection.
*/
container.documentEditor.selection.navigateNextRevision();
/**
* Navigate to previous tracked change from the current selection.
*/
container.documentEditor.selection.navigatePreviousRevision();
In DocumentEditor, we have built-in review panel in which we have provided support for filtering changes based on the user.