fix(frontend): resolve file loading, display, and cursor issues

- Fix API to return JSON response for file content instead of plain text
- Fix file display showing [object Object] by properly extracting content field
- Fix infinite save loop by tracking last saved content
- Remove auto-save that was causing cursor jumping on every keystroke
- Add manual save button with disabled state when content unchanged
- Add validation in FileList to prevent undefined filenames
- Improve error handling for file operations
This commit is contained in:
2026-02-05 19:09:07 -05:00
parent 67c4bdf0c7
commit bb6019ae8d
4 changed files with 101 additions and 59 deletions

View File

@@ -95,8 +95,13 @@ func (s *Server) handleGetFiles(w http.ResponseWriter, r *http.Request) {
s.sendError(w, http.StatusNotFound, err.Error())
return
}
w.Header().Set("Content-Type", "text/markdown")
w.Write([]byte(content))
// Return file content as JSON
response := map[string]string{
"name": filename,
"content": content,
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(response)
return
}