In the codemirror documentation, they have a method called markText (http://codemirror.net/doc/manual.html#api_marker). I have looked over the documentation and still do not understand what to do.
var word = CodeMirror.fromTextArea(document.getElementById('words'), {
mode: "text/html",
});
word.markText({1,1},{3,1}, readOnly: true);
The code above does not seam to work. Please tell me how to correctly use the markText method.
Thanks in advance!
This could be used to, for example, replace a textarea with a real editor: var myCodeMirror = CodeMirror(function(elt) { myTextArea. parentNode. replaceChild(elt, myTextArea); }, {value: myTextArea.
CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with a number of language modes and addons that implement more advanced editing functionality.
About. CodeMirror is open source under a permissive license (MIT). It is being developed on GitHub. Contributions are welcome.
Download CodeMirror files. Download jQuery file. Inside the codemirror project folder create subfolders and name them js, css and plugin. The js folder will hold all the javascript files.
After some more thinking I found out how to do it.
word.markText({line:1,ch:1},{line:3,ch:1},{readOnly:true});
I simply forgot that it had to be an object. My bad.
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