Skip to content

Commit

Permalink
refactor(editor): use doc title and id as snapshot file name (#10397)
Browse files Browse the repository at this point in the history
  • Loading branch information
donteatfriedrice committed Feb 24, 2025
1 parent 60b994f commit 378bb37
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion blocksuite/affine/block-root/src/transformers/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
})
);
Expand Down Expand Up @@ -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`);
}

Expand Down

0 comments on commit 378bb37

Please sign in to comment.