Is it possible to 'Revert to Saved'?

api

#1

When my plugin finishes exporting renditions, I would like to revert the document to its original/last saved state. Is it possible to trigger this via the API? The result of a user clicking ‘Revert to Saved’ in the File menu is exactly what I want.


#2

Currently, plugins can only revert their actions by throwing an error.

Can you give a use case where reverting to the saved state would be useful?


#3

Hi Kerri,
My plugin searches for logo placeholders, applies images fills to them, exports renditions, and then repeats for each set of user provided logos. Ideally the placeholders would reset to their original solid color fills instead of displaying the last logo applied.
It would also be valuable to revert all temporary changes made by the plugin with one simple call. The changes are necessary for each rendition export but they have no use after exporting has completed.

Also, thank you for being hyperactive on this forum! I’ve been able to piece together a fairly advanced plugin (in my JS beginner’s opinion) with all your insights and code examples.


#4

It sounds like you can do what you want, if you do what Kerri suggests.

(Throwing an error when you’re done will revert all the changes you’ve made. And without an error dialog, it won’t appear to be an erroring situation to the user.)