Working with review changes
Use the Automation API to accept or reject tracked changes from an external UI — without the user touching the editor directly.
The document opens in Track Changes mode. Your code calls connector.executeMethod() to navigate and resolve changes. The editor updates in real time.
How it works
-
On document ready, the total number of review changes is retrieved using GetReviewReport via
connector.callCommandand displayed in the counter:connector.callCommand(() => {const doc = Api.GetDocument();const report = doc.GetReviewReport();let total = 0;for (const user in report) {total += report[user].length;}return total;}, (total) => {reviewCount = total;reviewIndex = total > 0 ? 1 : 0;updateCounter();}); -
When the user clicks the Accept / Reject buttons in the custom interface, the AcceptReviewChanges / RejectReviewChanges methods are executed to accept / reject the selected change in the editor:
document.getElementById("accept").addEventListener("click", () => {connector.executeMethod("AcceptReviewChanges");});document.getElementById("reject").addEventListener("click", () => {connector.executeMethod("RejectReviewChanges");}); -
When the user clicks the Prev / Next buttons in the custom interface, the MoveToNextReviewChange method is executed to navigate between review changes:
document.getElementById("prev").addEventListener("click", () => {connector.executeMethod("MoveToNextReviewChange", [false]);});document.getElementById("next").addEventListener("click", () => {connector.executeMethod("MoveToNextReviewChange");});
Please note that the connector is available only for ONLYOFFICE Docs Developer.
The connector is an additional feature not included by default in the ONLYOFFICE Docs Developer and is available at an extra cost. Please contact our sales team at sales@onlyoffice.com to request a quote.