保存状态

This commit is contained in:
Van 2014-10-31 15:54:54 +08:00
parent ac743ca17f
commit 2c20093661
3 changed files with 21 additions and 1 deletions

View File

@ -186,6 +186,10 @@
background-color: #F7F7F7; background-color: #F7F7F7;
} }
.edit-panel .tabs > div > span.changed {
font-weight: bold;
}
.toolbars { .toolbars {
position: absolute; position: absolute;
right: 5px; right: 5px;

View File

@ -218,6 +218,9 @@ var editors = {
}; };
} }
} }
editor.doc.markClean();
$(".edit-panel .tabs > div.current > span").removeClass("changed");
} }
}); });
@ -488,7 +491,7 @@ var editors = {
} else { } else {
windows.maxEditor(); windows.maxEditor();
} }
}, }
} }
}); });
@ -508,6 +511,16 @@ var editors = {
$(".edit-exprinfo").remove(); $(".edit-exprinfo").remove();
}); });
editor.on('changes', function (cm) {
if (cm.doc.isClean()) {
// 没有修改过
$(".edit-panel .tabs > div.current > span").removeClass("changed");
} else {
// 修改过
$(".edit-panel .tabs > div.current > span").addClass("changed");
}
});
editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height()); editor.setSize('100%', $(".edit-panel").height() - $(".edit-panel .tabs").height());
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"]);

View File

@ -748,6 +748,9 @@ var wide = {
wide._save(); wide._save();
} }
curEditor.doc.markClean();
$(".edit-panel .tabs > div.current > span").removeClass("changed");
}, },
openAbout: function () { openAbout: function () {
$("#dialogAbout").dialog("open"); $("#dialogAbout").dialog("open");