Implement some kind of UndoRecord class in office-js for Office Word
Hi, Yun_Wang. Thanks for the answer!
In my case, I need an API that will allow me to put multiple commands in a batch, and if the user decides to undo the action they took, all the commands in the batch will be undone (by pressing Ctrl+z or Undo just once).
My specific use case: I have an add-in that does some rendering on a document (by changing a few content controls) and after rendering is complete, it also updates some document props. I can't do it within a single context.sync call and sometimes even within a single Word.run call due to business logic.
And once that is complete, the user will only be able to undo it by pressing Word's undo button (or Ctrl+z) multiple times. So I want to fix this so that the user can do the undo operation once.
In VSTO version I'm using the UndoRecord class to achieve this. So I'm looking for something similar in the OfficeJS API.
Regards,
Alex.