Skip to content

Commit

Permalink
only allow saving as .tldz
Browse files Browse the repository at this point in the history
  • Loading branch information
skhmt committed Nov 28, 2024
1 parent 702d5ad commit ab37608
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/mainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ export const actionOverrides: TLUiOverrides = {
const file = await serializeTldrawJsonBlob(editor);
try {
// @ts-expect-error Type 'ShowSaveFilePickerOptions' is not assignable to type 'undefined'.
const handle = await window.showSaveFilePicker({ suggestedName: `project_${getTimestamp()}.tldz` });
const handle = await window.showSaveFilePicker({
suggestedName: `project_${getTimestamp()}.tldz`,
types: [
{
description: 'Compressed Tldraw project',
accept: {
'application/tldz': ['.tldz']
}
}
]
});
const writableStream = await handle.createWritable();
const compressionStream = new CompressionStream('gzip');
await file.stream().pipeThrough(compressionStream).pipeTo(writableStream);
Expand Down

0 comments on commit ab37608

Please sign in to comment.