refactor(export/zip): separate building provider into own method

This commit is contained in:
Elian Doran
2025-06-23 18:24:59 +03:00
parent a9f68f5487
commit acb0991d05
2 changed files with 25 additions and 23 deletions

View File

@@ -35,13 +35,15 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
}
}
prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta, note: BNote, branch: BBranch): string | Buffer {
prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta, note: BNote | undefined, branch: BBranch): string | Buffer {
if (!noteMeta?.notePath?.length) {
throw new Error("Missing note path.");
}
const basePath = "../".repeat(noteMeta.notePath.length - 1);
content = renderNoteForExport(note, branch, basePath);
if (note) {
content = renderNoteForExport(note, branch, basePath);
}
return content;
}