mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 17:55:52 +01:00
refactor(export/share): share type for format
This commit is contained in:
@@ -6,6 +6,8 @@ import mimeTypes from "mime-types";
|
||||
|
||||
type RewriteLinksFn = (content: string, noteMeta: NoteMeta) => string;
|
||||
|
||||
export type ExportFormat = "html" | "markdown" | "share";
|
||||
|
||||
export interface AdvancedExportOptions {
|
||||
/**
|
||||
* If `true`, then only the note's content will be kept. If `false` (default), then each page will have its own <html> template.
|
||||
@@ -49,7 +51,7 @@ export abstract class ZipExportProvider {
|
||||
abstract prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta, note: BNote | undefined, branch: BBranch): string | Buffer;
|
||||
abstract afterDone(rootMeta: NoteMeta): void;
|
||||
|
||||
mapExtension(type: string | null, mime: string, existingExtension: string, format: string) {
|
||||
mapExtension(type: string | null, mime: string, existingExtension: string, format: ExportFormat) {
|
||||
// the following two are handled specifically since we always want to have these extensions no matter the automatic detection
|
||||
// and/or existing detected extensions in the note name
|
||||
if (type === "text" && format === "markdown") {
|
||||
|
||||
@@ -65,10 +65,6 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
||||
this.#saveIndex(rootMeta);
|
||||
}
|
||||
|
||||
mapExtension(_type: string | null, _mime: string, _existingExtension: string, _format: string): string | null {
|
||||
return "html";
|
||||
}
|
||||
|
||||
#saveIndex(rootMeta: NoteMeta) {
|
||||
if (!this.indexMeta?.dataFileName) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user