CodeMirror MarkText

In the codemirror documentation, they have a method called markText ( http://codemirror.net/doc/manual.html#api_marker ). I looked through 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 seam does not work in the above code. Tell me how to use the markText method correctly.

Thanks in advance!

+4
source share
1 answer

After a few thoughts, I learned how to do this.

word.markText({line:1,ch:1},{line:3,ch:1},{readOnly:true});

I just forgot that this should be an object. My bad.

+5
source

All Articles