Fix save issue

This commit is contained in:
Steve Ruiz 2021-06-11 11:42:23 +01:00
parent 110d8fe0b1
commit 260772e682
2 changed files with 8 additions and 4 deletions

View file

@ -1499,7 +1499,6 @@ const state = createState({
},
forceSave(data) {
// storage.saveToLocalStorage(data)
storage.saveToFileSystem(data)
},

View file

@ -122,10 +122,11 @@ class Storage {
saveAsToFileSystem = (data: Data) => {
// Create a new document id when saving to the file system
this.saveToFileSystem(data, uuid())
}
saveToFileSystem = (data: Data, id = data.document.id) => {
saveToFileSystem = (data: Data, id?: string) => {
// Save to local storage first
this.saveToLocalStorage(data, id)
@ -138,11 +139,15 @@ class Storage {
fa.fileSave(
blob,
{
fileName: `${data.document.name}.tldr`,
fileName: `${
id
? data.document.name
: this.previousSaveHandle?.name || 'My Document'
}.tldr`,
description: 'tldraw file',
extensions: ['.tldr'],
},
this.previousSaveHandle,
id ? undefined : this.previousSaveHandle,
true
)
.then((handle) => {