UndoManager history node information

I’m developing a History Manager. How do I get to the node data here? I will put the node key information in the name field but I couldn’t find the relevant node


let result = [];
this.diagram.undoManager.history.each((transaction) => {
                if (transaction.isComplete) {
                    result.push({
                        text: transaction.name,
                        name: *???* // *node key information*
                    });
                }
            });

I don’t understand what you are trying to accumulate. What if multiple nodes have been modified within a single transaction?

I am trying to get the Node key information
Which node was moved, which node was deleted, etc.

You might want to read https://gojs.net/latest/intro/changedEvents.html, which covers what I think you need to do.

I found a solution like this

            let i = 0;
            this.diagram.undoManager.history.each((transaction) => {
                if (transaction.isComplete) {
                    result.transactions.push({
                        text: transaction.name,
                        changes: [],
                        externalData: {
                            historyIndex: i
                        },
                        icon: this.icons[transaction.name.split(' ').join('_')] || "history",
                        key: this.itemAlias + i.toString()
                    });

                    transaction.changes.each((e: any) => {
                        if (e.object && e.object.data && e.object.data.key) {
                            result.transactions[i].name = e.object.data.key;
                        }
                    });
                }
                i++;
            });