This commit is contained in:
Liang Ding 2014-10-27 14:42:33 +08:00
parent 66d651eba6
commit 0f4a20e261
1 changed files with 4 additions and 2 deletions

View File

@ -445,7 +445,10 @@ var editors = {
var rulers = []; var rulers = [];
rulers.push({color: "#ccc", column: 120, lineStyle: "dashed"}); rulers.push({color: "#ccc", column: 120, lineStyle: "dashed"});
var editor = CodeMirror.fromTextArea(document.getElementById("editor" + id), { var textArea = document.getElementById("editor" + id);
textArea.value = data.content;
var editor = CodeMirror.fromTextArea(textArea, {
lineNumbers: true, lineNumbers: true,
autofocus: true, autofocus: true,
autoCloseBrackets: true, autoCloseBrackets: true,
@ -505,7 +508,6 @@ var editors = {
}); });
editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height()); editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height());
editor.setValue(data.content);
editor.setOption("mode", data.mode); editor.setOption("mode", data.mode);
editor.setOption("gutters", ["CodeMirror-lint-markers", "CodeMirror-foldgutter"]); editor.setOption("gutters", ["CodeMirror-lint-markers", "CodeMirror-foldgutter"]);