Support for history commands including undo(), redo(), markHistoryEvent(“Moved 10 pixels left”), isDirty() and getHistoryArray().
In plugins it’s often the case that your plugin makes a change. Having access to undo() would allow your plugin to make changes and then undo them without exiting the plugin.
Bob writes a plugin that modifies the artboard but sometimes his changes are temporary. He adds an line to the artboard, gets the rotation matrix and then uses
command.undo() to remove it.
Bob wants the default font information so he temporarily adds a text field to the artboard, gets the font values and then uses command.undo() to remove the text field.
Greta is making an History panel for XD. She gets the history commands and fills the undo history list. She has undo and redo buttons that call
Victor is making an instructional plugin that teaches people how to use XD. His first guide is adding a rectangle to the stage and setting the fill to a linear gradient.
When he adds an ellipse and sets the linear gradient. At each step he calls
markHistoryEvent() then uses the
undo() command to go back to the first step. He has created a step by step walk through.
Then the user is instructed to exit the plugin and use the undo and redo shortcuts to move forward step by step in the action history.