文件类型基于 Mime Type

This commit is contained in:
Liang Ding 2014-09-06 22:33:09 +08:00
parent 60c820697c
commit 46cafd27a8
2 changed files with 12 additions and 12 deletions

View File

@ -235,7 +235,7 @@ func listFiles(dirname string) []string {
}
func getIconSkin(filenameExtension string) string {
if "" == filenameExtension {
if "" == filenameExtension || ".exe" == filenameExtension {
return "ico-ztree-other "
}
@ -263,25 +263,25 @@ func getIconSkin(filenameExtension string) string {
func getEditorMode(filenameExtension string) string {
switch filenameExtension {
case ".go":
return "go"
return "text/x-go"
case ".html":
return "htmlmixed"
return "text/html"
case ".md":
return "markdown"
return "text/x-markdown"
case ".js":
return "javascript"
return "text/javascript"
case ".json":
return "application/json"
case ".css":
return "css"
return "text/css"
case ".xml":
return "xml"
return "application/xml"
case ".sh":
return "shell"
return "text/x-sh"
case ".sql":
return "sql"
return "text/x-sql"
default:
return "text"
return "text/plain"
}
}

View File

@ -173,9 +173,9 @@ var editors = {
editor.setSize('100%', $(".edit-panel").height() - $(".edit-header").height());
editor.setValue(data.content);
editor.setOption("mode", data.mode);
editor.setOption("gutters", ["CodeMirror-lint-markers"]);
if ("application/json" === data.mode) {
editor.setOption("lint", true);
}