Snapshot based Undo\Redo

Hi,

We would like to have a robust undo operation. Since we heavily rely on decoration in our plugins’ state, the ProseMirror’s history plugin doesn’t work well for our application.

I would like to understand if there is any potential issue with using a “snapshot based” undo mechanism that captures the editor state each several transactions (or any refinement of this logic).

To me it sounds extremely robust, other than using potentially large amount of memory (which I can choose to be restricted to my desire).

Am I missing anything? Any other drawbacks? Is there a chance that the older states that I am keeping get corrupted somehow?

Thanks

Not really, except that it won’t be appropriate in collaborative editing scenarios, or other situations where you want some changes to not be recorded in the undo history.

This won’t use that much memory either, since ProseMirror documents share structure across updates.