This commit is contained in:
Liang Ding 2014-09-07 00:13:25 +08:00
parent 10ddfa6251
commit f56c57109c
3 changed files with 6 additions and 3 deletions

View File

@ -74,7 +74,7 @@ func WSHandler(w http.ResponseWriter, r *http.Request) {
} }
} }
func FmtHandler(w http.ResponseWriter, r *http.Request) { func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
data := map[string]interface{}{"succ": true} data := map[string]interface{}{"succ": true}
defer util.RetJSON(w, r, data) defer util.RetJSON(w, r, data)

View File

@ -88,7 +88,7 @@ func main() {
// 编辑器 // 编辑器
http.HandleFunc("/editor/ws", editor.WSHandler) http.HandleFunc("/editor/ws", editor.WSHandler)
http.HandleFunc("/fmt", editor.FmtHandler) http.HandleFunc("/go/fmt", editor.GoFmtHandler)
http.HandleFunc("/autocomplete", editor.AutocompleteHandler) http.HandleFunc("/autocomplete", editor.AutocompleteHandler)
// Shell // Shell

View File

@ -127,9 +127,12 @@ var wide = {
"cursorLine": wide.curEditor.getCursor().line, "cursorLine": wide.curEditor.getCursor().line,
"cursorCh": wide.curEditor.getCursor().ch "cursorCh": wide.curEditor.getCursor().ch
}; };
// TODO: HTML/XML/JSON 格式化处理
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/fmt', url: '/go/fmt',
data: JSON.stringify(request), data: JSON.stringify(request),
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {