Serialize and save undo history?

Has anyone had success serializing the undo and redo histories to save and load along with the document? It seems like a straightforward problem, but before I dig into the particulars of JavaScript serialization, I thought I’d ask if there’s a common approach or solution I’m missing.

If you have code or insight you’re willing to share, please do! I’ve never had to deal with serialization in JS before, if there’s an easy solution here I’d love to know before I spend a few hours trying to figure this out from scratch.

Use the last argument to EditorState.toJSON/fromJSON, with a value like {history: historyField}.

1 Like

Thank you! I’m so glad I asked, it didn’t occur to me to look at the editor state itself for serialization.