mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
* add migration file * documents.export API * download dialog * file ops list item * export task * download modal styling * cleanup * lint * Restore individual download actions --------- Co-authored-by: Tom Moor <tom@getoutline.com>
37 lines
1002 B
TypeScript
37 lines
1002 B
TypeScript
import JSZip from "jszip";
|
|
import type { NavigationNode } from "@shared/types";
|
|
import { FileOperationFormat } from "@shared/types";
|
|
import type { Collection, FileOperation } from "@server/models";
|
|
import type { Document } from "@server/models";
|
|
import ExportDocumentTreeTask from "./ExportDocumentTreeTask";
|
|
|
|
export default class ExportMarkdownZipTask extends ExportDocumentTreeTask {
|
|
public async exportCollections(
|
|
collections: Collection[],
|
|
fileOperation: FileOperation
|
|
) {
|
|
const zip = new JSZip();
|
|
|
|
return await this.addCollectionsToArchive(
|
|
zip,
|
|
collections,
|
|
FileOperationFormat.MarkdownZip,
|
|
fileOperation.options?.includeAttachments
|
|
);
|
|
}
|
|
|
|
public async exportDocument(
|
|
document: Document,
|
|
documentStructure: NavigationNode[]
|
|
): Promise<string> {
|
|
const zip = new JSZip();
|
|
|
|
return await this.addDocumentToArchive({
|
|
document,
|
|
documentStructure,
|
|
format: FileOperationFormat.MarkdownZip,
|
|
zip,
|
|
});
|
|
}
|
|
}
|