mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +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 { createZipStream } = await import("../utils/streams/zip-stream");
|
||||||
|
|
||||||
const errors: Error[] = [];
|
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(
|
await fromAsyncIterator(
|
||||||
_exportNotes(notes, { format, unlockVault: Vault.unlockVault })
|
_exportNotes(notes, { format, unlockVault: Vault.unlockVault })
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,8 +28,13 @@ export class ExportStream extends TransformStream<
|
|||||||
> {
|
> {
|
||||||
progress = 0;
|
progress = 0;
|
||||||
constructor(
|
constructor(
|
||||||
report: (progress: { text: string; current?: number }) => void,
|
report: (progress: {
|
||||||
handleError: (error: Error) => void
|
text: string;
|
||||||
|
current?: number;
|
||||||
|
total?: number;
|
||||||
|
}) => void,
|
||||||
|
handleError: (error: Error) => void,
|
||||||
|
totalItems?: number
|
||||||
) {
|
) {
|
||||||
super({
|
super({
|
||||||
transform: async (item, controller) => {
|
transform: async (item, controller) => {
|
||||||
@@ -69,7 +74,8 @@ export class ExportStream extends TransformStream<
|
|||||||
controller.enqueue(item);
|
controller.enqueue(item);
|
||||||
report({
|
report({
|
||||||
current: this.progress++,
|
current: this.progress++,
|
||||||
text: `Exporting note: ${item.path}`
|
text: `Exporting note: ${item.path}`,
|
||||||
|
total: totalItems
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user