We are finally implementing undo and copy/paste and I changed our code to allow these. Copy/paste works along with other keyboard shortcuts but ctrl-z and alt-backspace don’t do an undo. This is on Window 10 and Chrome. Is there anything else I have to enable for undo shortcuts to work? Here is my code I just changed:
Thanks for the help I got the undo working. Now I need to find a way to be notified when it happens so I can modify data in our app. I’ve tried several things and no luck. I thought this might be the way but it doesn’t work.
You’re on the right path, but you need to get events on the Model, not on the Diagram, and then check ChangedEvent.isTransactionFinished. More discussion is at GoJS Changed Events -- Northwoods Software
Slowly making progress on this and I figured out how to get the modified Nodes and Links. The below gets called if I move a node and do ctrl-z. If I delete a node and do ctrl-z it doesn’t get called but the node does return. Shouldn’t both moves and deletes cause a FinishedUndo to happen?
Remember that you should be working with changes to the model and data in the model, not with the Diagram nor its Nodes nor its Links, nor with any of the individual GraphObjects in those Nodes or Links.
That means you should only care about those ChangedEvents that have a ChangedEvent.model, not with those that have a ChangedEvent.diagram.