我刚刚将 CodeMirror 升级到最新版本,现在以下代码中断:
// clear previous errors from editor window
for (var i = 0; i < layoutCodeEditor.lineCount(); i++) {
layoutCodeEditor.clearMarker(i);
layoutCodeEditor.setLineClass(i, null, null);
}
var valid = JSLINT(code);
var jsLintError = "";
if (!valid) {
jsLintError = JSLINT.error_report(JSLINT.data());
_.chain(JSLINT.errors).compact().each(function(e){
// show markers in the code edit window against lines with Jslint errors
layoutCodeEditor.setMarker((+e.line) - 1, "●", "errors");
layoutCodeEditor.setLineClass(+(e.line) - 1, null, "errorLine");
})
}
似乎 setMarker/clearMarker 和 setLineClass 函数已被删除。他们现在的等价物是什么?