Restarting Editor

Further to Programmatically editing the Editor content, I now edit the textarea content directly.

What is the best way to refresh the CodeMirror output?

cm.refresh() doesn’t appear to be the right choice.
cm.toTextArea() will over-write the textarea content which is undesirable.

Currently, I am restating the editor CodeMirror.fromTextArea() without terminating the previous instance which seems to work.

The question is that, would starting a new instance without terminating the previous one, be the right choice and/or would it cause any issues?

PS. I am new to CodeMirror and implementing CodeMirror as the editor in the next version of my FireMonkey Firefox extension.

I now edit the textarea content directly.

Well, don’t. As I mentioned, you want replaceRange if you’re changing the editor content. Or setValue if that’s too hard and you want to replace the entire content as a string.

Great … thank you.
getValue/setValue is the one.