I would like to reset all the contents of the Codemirror editor. Ideally, this should clear the textarea, remove all marks and clear the history.
What's the best way to achieve this?
Also, doing cm.setValue(newValue)
just sets content of the editor without deleting the CM instance. Doc
If you don't want to kill the CodeMirror instance, just change the entire document holding the text, data on markers etc.
This can be done by calling cm.swapDoc(doc: CodeMirror.Doc)
.