Undo shortcut not working

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:

    goDiagram.allowUndo = true;
    goDiagram.allowClipboard = true;

As you can see in the documentation, those Diagram properties are true by default: http://gojs.net/latest/api/symbols/Diagram.html

Actually that documentation also shows you how to turn on the diagram’s UndoManager, by setting http://gojs.net/latest/api/symbols/UndoManager.html#isEnabled to true.

You can see examples at http://gojs.net/latest/learn/index.html.

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.

    goDiagram.addChangedListener(function (e) {

onChanged: function(e) {
    var me = this;
    if (e.propertyName === 'StartingUndo') {

Any ideas on how I can listen for undo and redo events and get the node or link that was used?

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 http://gojs.net/latest/intro/changedEvents.html

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?

    goDiagram.model.addChangedListener(function (e) {

onChanged: function(e) {
    var me = this,

    if (!e.isTransactionFinished) {

    if (e.propertyName === 'FinishedUndo') {
        txn = e.object;
        txn.changes.each(function(change) {
            if (change.object instanceof go.Node) {
                console.log('Node ' + change.object.data.key + ' ' + change.change.toString() + ' ' + change.propertyName);
            else if (change.object instanceof go.Link) {
                console.log('Link ' + change.object.data.key + ' ' + change.change.toString() + ' ' + change.propertyName);

Have you seen the Update Demo, http://gojs.net/latest/samples/updatedemo.html ?

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.