feat(client/ts): port tree (WIP)

This commit is contained in:
Elian Doran
2025-01-28 15:44:15 +02:00
parent 546274a79d
commit 565989dd4c
14 changed files with 232 additions and 158 deletions

View File

@@ -5,7 +5,16 @@ import utils from "./utils.js";
import appContext from "../components/app_context.js";
import { t } from "./i18n.js";
export async function uploadFiles(entityType: string, parentNoteId: string, files: string[], options: Record<string, string | Blob>) {
interface UploadFilesOptions {
safeImport: boolean;
shrinkImages: boolean;
textImportedAsText: boolean;
codeImportedAsCode: boolean;
explodeArchives: boolean;
replaceUnderscoresWithSpaces: boolean;
}
export async function uploadFiles(entityType: string, parentNoteId: string, files: string[], options: UploadFilesOptions) {
if (!["notes", "attachments"].includes(entityType)) {
throw new Error(`Unrecognized import entity type '${entityType}'.`);
}
@@ -26,7 +35,7 @@ export async function uploadFiles(entityType: string, parentNoteId: string, file
formData.append("last", counter === files.length ? "true" : "false");
for (const key in options) {
formData.append(key, options[key]);
formData.append(key, (options as any)[key]);
}
await $.ajax({