Support for history commands


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.

Use Case
Bob writes a plugin that modifies the artboard. He adds an line to the artboard, gets the rotation matrix and then uses command.undo() to remove it.

Use Case
Greta is making an History panel for XD. She gets the history commands and makes it. She has undo and redo buttons that call command.undo() and command.redo().

Use Case
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.


I think until visual versioning is released it may not considered
any ideas @kerrishotts


Another related feature would be a revert() command.

Whenever a change is made in my plugin but an error occurs, all of those changes are reverted when the plugin dialog closes. So I think this method exists already.

If this API could be exposed then plugin authors could call it manually when the user clicks the cancel button.