【发布时间】:2016-06-24 11:09:21
【问题描述】:
我搜索了 Google 和这些论坛都没有运气。这是我的代码,错误似乎源于此。在源文件中挖掘是没有帮助的。这安装在多站点 WordPress 上,并与管理区域中的帖子等一起使用。所有网站在发布等时都会抛出此错误。
var editor = CodeMirror.fromTextArea(
document.getElementById("code"), {
lineNumbers: true,
mode: "text/x-scss",
theme: "solarized light",
lineWrapping: true,
onCursorActivity: function() {
editor.setLineClass(hlLine, null, null);
hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline"); }
});
var hlLine = editor.addLineClass(0, "background", "activeline");
editor.on("cursorActivity", function() {
var cur = editor.getLineHandle(editor.getCursor().line);
if (cur != hlLine) {
editor.removeLineClass(hlLine, "background", "activeline");
hlLine = editor.addLineClass(cur, "background", "activeline");
}
});
var number = jQuery(".CodeMirror-wrap").length;
if(number > 1){
jQuery(".CodeMirror-wrap").hide();
jQuery(".CodeMirror-wrap:first").show();
}
非常感谢任何见解。
【问题讨论】:
-
我也遇到了类似的问题,我已经把它贴在这里了:stackoverflow.com/q/69430941/7584240如果你有机会请看看并提供一些解决方案。
标签: jquery codemirror