feat: Add Monaco editor support

This commit is contained in:
shiyu
2025-09-10 11:40:24 +08:00
parent f484557874
commit fb0b7b13d1
4 changed files with 104 additions and 19 deletions

View File

@@ -38,7 +38,11 @@ export const vfsApi = {
});
return request<DirListing>(`/fs/${encodeURI(trimmed)}?${params}`);
},
readFile: (path: string) => request<ArrayBuffer>(`/fs/file/${encodeURI(path.replace(/^\/+/, ''))}`),
readFile: async (path: string) => {
const enc = encodeURI(path.replace(/^\/+/, ''));
const resp = await request(`/fs/file/${enc}`, { rawResponse: true });
return await (resp as Response).arrayBuffer();
},
uploadFile: (fullPath: string, file: File | Blob) => {
const fd = new FormData();
fd.append('file', file);