feat: Bulk HTML export (#4620)

* wip

* Working bulk html export

* Refactor

* test

* test
This commit is contained in:
Tom Moor
2022-12-30 17:42:20 +00:00
committed by GitHub
parent 1b8dd9399c
commit f3469d25fe
32 changed files with 485 additions and 258 deletions

View File

@@ -1,6 +1,7 @@
import { addDays, differenceInDays } from "date-fns";
import { floor } from "lodash";
import { action, autorun, computed, observable, set } from "mobx";
import { ExportContentType } from "@shared/types";
import parseTitle from "@shared/utils/parseTitle";
import { isRTL } from "@shared/utils/rtl";
import DocumentsStore from "~/stores/DocumentsStore";
@@ -419,10 +420,8 @@ export default class Document extends ParanoidModel {
};
}
download = async (
contentType: "text/html" | "text/markdown" | "application/pdf"
) => {
await client.post(
download = (contentType: ExportContentType) => {
return client.post(
`/documents.export`,
{
id: this.id,

View File

@@ -1,4 +1,5 @@
import { computed } from "mobx";
import { FileOperationFormat, FileOperationType } from "@shared/types";
import { bytesToHumanReadable } from "@shared/utils/files";
import BaseModel from "./BaseModel";
import User from "./User";
@@ -16,7 +17,9 @@ class FileOperation extends BaseModel {
size: number;
type: "import" | "export";
type: FileOperationType;
format: FileOperationFormat;
user: User;