An Office service that supports add-ins to interact with objects in Office client applications.
Hello RahulK
Thank you for posting question in Microsoft Q&A Forum.
According to this issue, I have found this URL: https://learn.microsoft.com/en-us/javascript/api/requirement-sets/word/word-api-desktop-1.4-requirement-set?view=word-js-preview
The WordApiDesktop requirement set is a special requirement set that includes features that are only available for Word on Windows and on Mac. APIs in this requirement set are considered to be production APIs for the Word application on Windows and on Mac. WordApiDesktop APIs are considered to be "preview" APIs for other platforms (for example, web) and may not be supported by any of those platforms.
I also found undo() is displayed on this:
You could check on this by searching in the table below the URL I provided above.
Based on my understanding, in Word on the web, every user is a part of real time co-authoring session. When you call acceptAllRevisions(), Word on the Web must reconcile this with the "Master" version on the server. To prevent the document from becoming corrupted or out of sync for other users, the web client often clears the local Undo stack. Once the stack is cleared, the undo() command fails because there is no "previous state" to return to.
Instead of using undo() as it is unreliable in the browser, you could consider performing a sanitization on a "copy" of the document data. Instead of changing user's live document, you could take a copy then clean it and save the result.
I also read your step 15 and thought that it should have been the first step of this sanitization process.
After all, my suggestion should be using 15th step as the first step as the undo() has its own limitation.
I hope this information is helpful. Please let me know if I misunderstood your point at any time or if you have any further question.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.