文件类型基于 Mime Type
This commit is contained in:
parent
60c820697c
commit
46cafd27a8
|
@ -235,7 +235,7 @@ func listFiles(dirname string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getIconSkin(filenameExtension string) string {
|
func getIconSkin(filenameExtension string) string {
|
||||||
if "" == filenameExtension {
|
if "" == filenameExtension || ".exe" == filenameExtension {
|
||||||
return "ico-ztree-other "
|
return "ico-ztree-other "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,25 +263,25 @@ func getIconSkin(filenameExtension string) string {
|
||||||
func getEditorMode(filenameExtension string) string {
|
func getEditorMode(filenameExtension string) string {
|
||||||
switch filenameExtension {
|
switch filenameExtension {
|
||||||
case ".go":
|
case ".go":
|
||||||
return "go"
|
return "text/x-go"
|
||||||
case ".html":
|
case ".html":
|
||||||
return "htmlmixed"
|
return "text/html"
|
||||||
case ".md":
|
case ".md":
|
||||||
return "markdown"
|
return "text/x-markdown"
|
||||||
case ".js":
|
case ".js":
|
||||||
return "javascript"
|
return "text/javascript"
|
||||||
case ".json":
|
case ".json":
|
||||||
return "application/json"
|
return "application/json"
|
||||||
case ".css":
|
case ".css":
|
||||||
return "css"
|
return "text/css"
|
||||||
case ".xml":
|
case ".xml":
|
||||||
return "xml"
|
return "application/xml"
|
||||||
case ".sh":
|
case ".sh":
|
||||||
return "shell"
|
return "text/x-sh"
|
||||||
case ".sql":
|
case ".sql":
|
||||||
return "sql"
|
return "text/x-sql"
|
||||||
default:
|
default:
|
||||||
return "text"
|
return "text/plain"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,9 +173,9 @@ var editors = {
|
||||||
editor.setSize('100%', $(".edit-panel").height() - $(".edit-header").height());
|
editor.setSize('100%', $(".edit-panel").height() - $(".edit-header").height());
|
||||||
editor.setValue(data.content);
|
editor.setValue(data.content);
|
||||||
editor.setOption("mode", data.mode);
|
editor.setOption("mode", data.mode);
|
||||||
|
|
||||||
editor.setOption("gutters", ["CodeMirror-lint-markers"]);
|
editor.setOption("gutters", ["CodeMirror-lint-markers"]);
|
||||||
|
|
||||||
if ("application/json" === data.mode) {
|
if ("application/json" === data.mode) {
|
||||||
editor.setOption("lint", true);
|
editor.setOption("lint", true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue