codemirror-modes

CodeMirror markText is not working

旧街凉风 提交于 2020-02-23 10:38:04
问题 I am using CodeMirror like this to show some XML response to User. HTML CODE <body> <textarea id="cm" >#{bean.xmlResponse}</textarea> </body> JS CODE window.onload = function () { var editor = CodeMirror.fromTextArea(document.getElementById('cm'), { mode: "xml", theme: "default" }); editor.getDoc().markText({line:5,ch:2},{line:5,ch:9},"color : red"); }; Now when I am trying to highlight some particular line by using markText which is not working. Of course "xml" mode is working but line 5 is

Codemirror gutter marker change issue

社会主义新天地 提交于 2019-12-08 07:22:52
问题 I have a requirement where i need to show line character counts in every line. I am showing it in gutter like such The limit on each line is 112, so the gutter number goes to negative when user types more than 112 characters. Everything works great. But when i do copy paste it doesn't work. The line is identified from the copy/paste texts and everything just the gutter marker which shows line character counts doesn't show. I have a little video demo of the behavior, and code posted below.