# Best way to reset editor with history plugin?

**URL:** <https://discuss.prosemirror.net/t/best-way-to-reset-editor-with-history-plugin/5922>\
**Category:** Uncategorized\
**Created:** [October 18, 2023, 7:39am UTC](https://discuss.prosemirror.net/t/best-way-to-reset-editor-with-history-plugin/5922 "2023-10-18T07:39:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![intaek-h](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/intaek-h/32/3303_2.png) [@intaek-h](https://discuss.prosemirror.net/u/intaek-h)\
**Post date:** [October 18, 2023, 7:39am UTC](https://discuss.prosemirror.net/t/best-way-to-reset-editor-with-history-plugin/5922/1 "2023-10-18T07:39:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [October 18, 2023, 8:09am UTC](https://discuss.prosemirror.net/t/best-way-to-reset-editor-with-history-plugin/5922/2 "2023-10-18T08:09:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![intaek-h](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/intaek-h/32/3303_2.png) [@intaek-h](https://discuss.prosemirror.net/u/intaek-h)\
**Post date:** [October 18, 2023, 8:35am UTC](https://discuss.prosemirror.net/t/best-way-to-reset-editor-with-history-plugin/5922/3 "2023-10-18T08:35:09Z")

</div>

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

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

```

this is the code that generates the mismatched transaction error.

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [October 18, 2023, 8:49am UTC](https://discuss.prosemirror.net/t/best-way-to-reset-editor-with-history-plugin/5922/4 "2023-10-18T08:49:45Z")

</div>

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.
