Best way to reset editor with history plugin?

I am making an editor for a service similar to chat. everytime the user sends a message, the content has to be deleted and forget its history so that even if the user presses CTRL-Z, past content don’t appear. I have checked that the history plugin does not provide reset method.

Create a fresh editor state, and set the view to that.

thank you! but i am having a hard time figuring out the way to replace the view with a fresh state.

  resetState() {
    this.view.updateState(EditorState.create({
      schema: this.extensionManager.schema,
      plugins: this.extensionManager.plugins,
    }))
  }

this is the code that generates the mismatched transaction error.

There is no way that code, itself, creates a mismatched transaction error. Look at the stack trace from the error to figure out which code is applying transactions incorrectly in your system.

1 Like