feat(docs): export database documentation as standalone HTML
This commit is contained in:
1 parent
efd0c381ad
commit
63498da121
59 files changed
+4374
-237
No files matched your search
@@ -184,6 +184,7 @@ export const collectDocsSnapshot = forward("collectDocsSnapshot");
|
||||
export const loadDocsAnnotations = forward("loadDocsAnnotations");
|
||||
export const applyDocsAnnotations = forward("applyDocsAnnotations");
|
||||
export const saveDocsAnnotations = forward("saveDocsAnnotations");
|
||||
export const exportDocsHtml = forward("exportDocsHtml");
|
||||
|
||||
// Query
|
||||
export const executeQuery = forward("executeQuery");
|
||||
|
||||
@@ -860,6 +860,21 @@ export async function saveDocsAnnotations(connectionId: string, annotations: Ann
|
||||
return post("/api/docs/annotations/save", { connectionId, annotations });
|
||||
}
|
||||
|
||||
export async function exportDocsHtml(filePath: string, snapshot: SchemaSnapshot, annotations: AnnotationFile, lang: string): Promise<void> {
|
||||
const result = await post<{ content: string }>("/api/docs/export", { snapshot, annotations, lang });
|
||||
// No `downloadTextFile` here: it prepends a BOM, which the Tauri command's
|
||||
// `std::fs::write(&file_path, html)` does not. The two callers must produce
|
||||
// byte-identical output for the same inputs.
|
||||
const fileName = filePath.split(/[\\/]/).pop() || "docs.html";
|
||||
const blob = new Blob([result.content], { type: "text/html;charset=utf-8" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = fileName;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Query
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -1681,6 +1681,10 @@ export async function saveDocsAnnotations(connectionId: string, annotations: Ann
|
||||
return invoke("docs_save_annotations", { connectionId, annotations });
|
||||
}
|
||||
|
||||
export async function exportDocsHtml(filePath: string, snapshot: SchemaSnapshot, annotations: AnnotationFile, lang: string): Promise<void> {
|
||||
return invoke("docs_export_html", { filePath, snapshot, annotations, lang });
|
||||
}
|
||||
|
||||
export async function saveConnections(configs: ConnectionConfig[]): Promise<void> {
|
||||
return invoke("save_connections", { configs });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user