In this sample Draggable Link, If any modification occurs then it will detect in this listener myDiagram.addDiagramListener(“Modified”, function(e) {…});
So, I have added diagram default to readOnly Property by assigning
myDiagram.isReadOnly = true;
and also added one check box for enabling and disabling the readOnly property.
I am trying to get undo and redo status once the model as been modified.
But I am facing issue when the diagram by default configured with readonly to true and after that changed to editable and doing operations like move, undo, redo then I am not get the exact status of undo redo
You have probably noticed by now that the “Modified” DiagramEvent is raised only once, when Diagram.isModified changes from false to true. Further changes to the diagram by the user will not cause the “Modified” DiagramEvent to be raised until you set Diagram.isModified to false.
Are you looking to update some user interface elements as the user makes changes to the diagram/model and as the user performs undo or redo? GoJS Commands -- Northwoods Software demonstrates that.
Oh, you’re not setting Diagram.isReadOnly within a transaction, so that when the user moves a node, that transaction effectively includes the earlier changes not included in a transaction.
So when the Undo happens, not only is the move undone, but so is the setting of Diagram.isReadOnly.
Hmmm, do you want setting Diagram.isReadOnly to be undoable? If so, wrap it in a transaction. If not, temporarily set Diagram.skipsUndoManager to true around the setting.
This is why we frequently (but I hope not too annoyingly) tell people to make all changes within a transaction.