Hi there,
I wonder if it is possible to serialize the redo/ undo stack together with the document content?
So that once I save and close the browser, open it again to load the document from a file, I
would still be able to do undo and redo on the changes I made previously?
Hey @khanhhaduc, it's definitely possible. You'd need to serialize/deserialize it on your own though since it's not supported out of the box. I don't think it'd would be too hard, if you take a look at the source to see how State objects are created with a History.
I'd also accept a pull request that split History into its own src/models/history.js and exported it at the top-level to make this use case easier if you wanted to write one!
Did not think of separating History but that actually makes much sense. Will be looking into doing so as I will be using this feature, as mentioned in #2678 and #2672
Most helpful comment
Hey @khanhhaduc, it's definitely possible. You'd need to serialize/deserialize it on your own though since it's not supported out of the box. I don't think it'd would be too hard, if you take a look at the source to see how
Stateobjects are created with aHistory.I'd also accept a pull request that split
Historyinto its ownsrc/models/history.jsand exported it at the top-level to make this use case easier if you wanted to write one!