You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to run a plugin just before the document is saved? I was really hoping for a 'DocumentSaved.Begin' action to exist, but that doesn't seem to be the case. Or maybe it's named something else?? 😅 ('DocumentSaved.Begin' doesn't make much grammatical sense).
Some context, I'm working on a plugin that changes improves some formatting of the document when it is saved. This seems like a pretty standard thing to do, most modern code editors now can autoformat code on save. However, the DocumentSaved action only seems to run the plugin after the save has happened which means any modifications that the plugin makes are not saved and the document is left in an 'unsaved changes' state immediately after saving.
Working around this currently by writing a bunch of code to diff my changes to document against what is currently in the document and then not doing anything if it won't change anything. This allows the plugin to call document save again after it is finished so that from the user’s perspective it doesn't look like anything wonky is going on. The diffing code is very complex relative to the rest of the plugin and would love not to need to maintain it going forward.
(😃 A million thanks for creating such an awesome product and supremely intuitive API. I wasn't expecting to be able to achieve a plugin with even a quarter of the functionality my plugin now has, it's incredible. The documentation and API are overall some of the best I've ever seen/used. 'Actions' seems to be a rough patch at the moment, but I'm sure that'll get improved! The functionality added there is completely brilliant.)
The text was updated successfully, but these errors were encountered:
Is there any way to run a plugin just before the document is saved? I was really hoping for a 'DocumentSaved.Begin' action to exist, but that doesn't seem to be the case. Or maybe it's named something else?? 😅 ('DocumentSaved.Begin' doesn't make much grammatical sense).
Some context, I'm working on a plugin that changes improves some formatting of the document when it is saved. This seems like a pretty standard thing to do, most modern code editors now can autoformat code on save. However, the
DocumentSaved
action only seems to run the plugin after the save has happened which means any modifications that the plugin makes are not saved and the document is left in an 'unsaved changes' state immediately after saving.Working around this currently by writing a bunch of code to diff my changes to document against what is currently in the document and then not doing anything if it won't change anything. This allows the plugin to call document save again after it is finished so that from the user’s perspective it doesn't look like anything wonky is going on. The diffing code is very complex relative to the rest of the plugin and would love not to need to maintain it going forward.
(😃 A million thanks for creating such an awesome product and supremely intuitive API. I wasn't expecting to be able to achieve a plugin with even a quarter of the functionality my plugin now has, it's incredible. The documentation and API are overall some of the best I've ever seen/used. 'Actions' seems to be a rough patch at the moment, but I'm sure that'll get improved! The functionality added there is completely brilliant.)
The text was updated successfully, but these errors were encountered: