How to dynamically switch modes with CodeMirror?
I have the default set, but need to switch it.
Something like this would help you.
First, set CodeMirror:
this.editor = CodeMirror.fromTextArea(document.getElementById("textAreaCodeMirror"), {
lineNumbers: true,
matchBrackets: true,
styleActiveLine: true,
theme:"eclipse",
mode:language
});
Then, to change the mode
this.editor.setOption("mode", language);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With