resetHistory command to forget the undo/redo history #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a PR for this discussion
The effect of
resetHistoryis the same of running the plugin's state.init() function again.Sometimes I want to reuse an editor with a different document, but I want to forget the history, because it would get me to the previous, different document.
Are you certain that your use case isn't better served by just creating a fresh
EditorStateand putting that in the existing view? Other plugins could be holding onto other state that doesn't belong in the new document. (I know I mentioned on the forum, a long time ago, that I'd welcome a PR for this, but I've come to the conclusion that reusing a state when loading a new document is usually not the right approach.)Thanks for the tip, @marijnh. I'll follow your advice, though I need to know how to create a fresh EditorState through tiptap's wrapper functions.
I'm not particularly attached to this PR, it's been a good way to learn something.
Pull request closed