Document Changes in CM6


I read CodeMirror Document Change Example and are able to insert code at the start of the document. However, I want to replace all the code that is in the editor with another code. What is the best way to do this in CM6? I looked around for a function to reset the view, but couldn’t find one.

Thanks and Best Regards

The recommended way to do this is to create a completely new state and call setState on the view.