mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-15 19:27:51 +01:00
Merge pull request #8999 from streetwriters/web/fix-export-notes-count
web: show total notes count in export dialog
This commit is contained in:
@@ -92,7 +92,11 @@ export async function exportNotes(
|
||||
const { createZipStream } = await import("../utils/streams/zip-stream");
|
||||
|
||||
const errors: Error[] = [];
|
||||
const exportStream = new ExportStream(report, (e) => errors.push(e));
|
||||
const exportStream = new ExportStream(
|
||||
report,
|
||||
(e) => errors.push(e),
|
||||
await notes.count()
|
||||
);
|
||||
await fromAsyncIterator(
|
||||
_exportNotes(notes, { format, unlockVault: Vault.unlockVault })
|
||||
)
|
||||
|
||||
@@ -28,8 +28,13 @@ export class ExportStream extends TransformStream<
|
||||
> {
|
||||
progress = 0;
|
||||
constructor(
|
||||
report: (progress: { text: string; current?: number }) => void,
|
||||
handleError: (error: Error) => void
|
||||
report: (progress: {
|
||||
text: string;
|
||||
current?: number;
|
||||
total?: number;
|
||||
}) => void,
|
||||
handleError: (error: Error) => void,
|
||||
totalItems?: number
|
||||
) {
|
||||
super({
|
||||
transform: async (item, controller) => {
|
||||
@@ -69,7 +74,8 @@ export class ExportStream extends TransformStream<
|
||||
controller.enqueue(item);
|
||||
report({
|
||||
current: this.progress++,
|
||||
text: `Exporting note: ${item.path}`
|
||||
text: `Exporting note: ${item.path}`,
|
||||
total: totalItems
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user