mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
feat(client/ts): port tree (WIP)
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user