Desktop: Unify save file handling and add file dialog for export (#3008)

* Prepare save file unification

* Desktop add save file dialog
This commit is contained in:
Timon
2025-08-06 16:07:53 +00:00
committed by GitHub
parent 5f2432cacf
commit 96a1b12a05
8 changed files with 47 additions and 30 deletions
+3 -3
View File
@@ -15,10 +15,10 @@ export function downloadFileBlob(filename: string, blob: Blob) {
URL.revokeObjectURL(url);
}
export function downloadFileText(filename: string, text: string) {
const type = filename.endsWith(".svg") ? "image/svg+xml;charset=utf-8" : "text/plain;charset=utf-8";
export function downloadFile(filename: string, content: Uint8Array) {
const type = filename.endsWith(".svg") ? "image/svg+xml;charset=utf-8" : "application/octet-stream";
const blob = new Blob([text], { type });
const blob = new Blob([content], { type });
downloadFileBlob(filename, blob);
}