Reset history plugin state

Hi, I’m sure this is a trivial question but, I’m wondering if I’m missing something here. Is there a way to completely reset the historystate to the init state based on the prosemirror-history module? Or is that impossible? I guess I could hack the plugin and take the apply function, and wrap it.

But thats where I’m at with this. I need to be able to drop the historystate to an empty state. And there doesnt appear to be a non-hack way to do this.

I should add that I know you can do stuff like creating a new state based off the EditorState class, and all sorts of stuff that is much weirder but, this is undesirable for us to swap out EditorStates in our editor environment or do manipulation of immutable objects like EditorState.

No, this does not currently exist. It would be possible to add such a feature to the history plugin—it’d basically involve adding support for a special type of transaction metadata to reset the history state, and then exporting a function that creates such a transaction, somewhat similar to closeHistory.

Thanks for the reply. I dont think we want to fork the module, so its likely I’ll wrap the plugin which is awkward but, seems to be the suggested solution with one of my co-workers.

I didn’t suggest a fork—I mean to say I’d accept a pull request that implements such a feature.

Sorry for resurrecting an old thread, but did somebody ever write such a PR? I see there are open issues on GitHub. I’m willing to give it a shot but I’d like to avoid duplicating effort.