I am using the tinyMce editor to edit PDFs. I want to try and preserve the undo stack from when I close the editor. To do this I serialise the undoManager.data and store it in the metadata of the PDF. Then when loading the document I read the PDFs metadata and deserialise the data. I then run into an issue when trying to add this data back into the undo manager. I am trying to add extra undo levels to the undoManager using: undoManager.add(newUndoLevel)
This works fine and in undoManager.data I can see I have an array with 1 undo element. The issue I am having is that this will only work once. If I try to add a 2nd undo level nothing happens. I can see in the source code that there is an undo level parameter and from what I can gather to add a second undo level I would have to do this: undoManager.add(anotherUndoLevel, {data: 1})
Unfortunately this doesn't do anything either. I have tried many different combinations of this to no avail. If anyone knows the correct way to do this, please let me know