Fix save issue
This commit is contained in:
parent
110d8fe0b1
commit
260772e682
2 changed files with 8 additions and 4 deletions
|
@ -1499,7 +1499,6 @@ const state = createState({
|
||||||
},
|
},
|
||||||
|
|
||||||
forceSave(data) {
|
forceSave(data) {
|
||||||
// storage.saveToLocalStorage(data)
|
|
||||||
storage.saveToFileSystem(data)
|
storage.saveToFileSystem(data)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -122,10 +122,11 @@ class Storage {
|
||||||
|
|
||||||
saveAsToFileSystem = (data: Data) => {
|
saveAsToFileSystem = (data: Data) => {
|
||||||
// Create a new document id when saving to the file system
|
// Create a new document id when saving to the file system
|
||||||
|
|
||||||
this.saveToFileSystem(data, uuid())
|
this.saveToFileSystem(data, uuid())
|
||||||
}
|
}
|
||||||
|
|
||||||
saveToFileSystem = (data: Data, id = data.document.id) => {
|
saveToFileSystem = (data: Data, id?: string) => {
|
||||||
// Save to local storage first
|
// Save to local storage first
|
||||||
this.saveToLocalStorage(data, id)
|
this.saveToLocalStorage(data, id)
|
||||||
|
|
||||||
|
@ -138,11 +139,15 @@ class Storage {
|
||||||
fa.fileSave(
|
fa.fileSave(
|
||||||
blob,
|
blob,
|
||||||
{
|
{
|
||||||
fileName: `${data.document.name}.tldr`,
|
fileName: `${
|
||||||
|
id
|
||||||
|
? data.document.name
|
||||||
|
: this.previousSaveHandle?.name || 'My Document'
|
||||||
|
}.tldr`,
|
||||||
description: 'tldraw file',
|
description: 'tldraw file',
|
||||||
extensions: ['.tldr'],
|
extensions: ['.tldr'],
|
||||||
},
|
},
|
||||||
this.previousSaveHandle,
|
id ? undefined : this.previousSaveHandle,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.then((handle) => {
|
.then((handle) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue