Currently, I have developed a real-time editing system that makes the changes on one machine reflect on another user’s machine and almost everything works flawlessly. I am, however, running into issues with undo and redo. Here are the steps that I am following:
-
First user changes the diagram.
-
The changes are reflected on diagram of the second user (this works).
-
First user undoes or redoes changes to the diagram.
-
Second user should see the undone or redone changes (this is not working). If the second user uses ctrl+z, ctrl+y, or the contextmenu, it undoes or redoes the first user’s change. I am using the following code but this doesn’t seem to work. I know it is calling the code because I have replaced undo() with deleteSelection() and that works.
data.origin == 'diagram-undo' ? fileDiagram.commandHandler.undo() : fileDiagram.commandHandler.redo();
Long story short, how do I call the undo stack inside of a function?