How to undo on button press?

After reading the documentation I’m not sure how to call the undo history function programmatically, for example on a button press. Thank you!

You can do…

import {undo} from "@codemirror/history"

myButton.onmousedown = e => {
  undo(view)
  e.preventDefault()
}
1 Like

Thank you very much!