Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

refactor(editor): use doc title and id as snapshot file name (#10397)

donteatfriedrice378bb3795d05
diff --git a/blocksuite/affine/block-root/src/transformers/zip.ts b/blocksuite/affine/block-root/src/transformers/zip.ts
index fdae392360..6db2c6c8fb 100644
--- a/blocksuite/affine/block-root/src/transformers/zip.ts
+++ b/blocksuite/affine/block-root/src/transformers/zip.ts
@@ -29,7 +29,10 @@ async function exportDocs(collection: Workspace, docs: Store[]) {
snapshots
.filter((snapshot): snapshot is DocSnapshot => !!snapshot)
.map(async snapshot => {
- const snapshotName = `${snapshot.meta.title || 'untitled'}.snapshot.json`;
+ // Use the title and id as the snapshot file name
+ const title = snapshot.meta.title || 'untitled';
+ const id = snapshot.meta.id;
+ const snapshotName = `${title}-${id}.snapshot.json`;
await zip.file(snapshotName, JSON.stringify(snapshot, null, 2));
})
);
@@ -63,6 +66,7 @@ async function exportDocs(collection: Workspace, docs: Store[]) {
}
const downloadBlob = await zip.generate();
+ // Use the collection id as the zip file name
return download(downloadBlob, `${collection.id}.bs.zip`);
}