Can We get last modified data after undo & redo?


#1

Can We get last modified data after undo and redo?
How to get which data is removed after undo?
How to get which data is added after undo?
Is there any sample for those actions?


#2

Define a Model Changed listener:
https://gojs.net/latest/api/symbols/Model.html#addChangedListener or https://gojs.net/latest/api/symbols/Diagram.html#addModelChangedListener

The listener gets called with a ChangedEvent, https://gojs.net/latest/api/symbols/ChangedEvent.html. Your case is when (e.change === ChangedEvent.Transaction && (e.propertyName === "FinishedUndo" || e.propertyName === "FinishedRedo")).

At that time e.object may be a Transaction (but it might be null). You can then look at its https://gojs.net/latest/api/symbols/Transaction.html#changes to see all of the ChangedEvents that happened in that Transaction.

Also, might this be of any interest to you? https://gojs.net/latest/api/symbols/Model.html#toIncrementalJson and https://gojs.net/latest/samples/stateChartIncremental.html