Null file handle doesn’t need to be passed (#1752)
* Bump browser-nativefs version to v0.2.0 In reply to https://github.com/tomayac/browser-nativefs/issues/2. * Update package-lock.json * Null file handle doesn’t need to be passed
This commit is contained in:
parent
5d3867d8ac
commit
3cee0768cc
@ -30,25 +30,16 @@ export const saveAsJSON = async (
|
|||||||
const blob = new Blob([serialized], {
|
const blob = new Blob([serialized], {
|
||||||
type: "application/json",
|
type: "application/json",
|
||||||
});
|
});
|
||||||
// Either "Save as" or non-supporting browser
|
const name = `${appState.name}.excalidraw`;
|
||||||
if (!fileHandle) {
|
(window as any).handle = await fileSave(
|
||||||
const name = `${appState.name}.excalidraw`;
|
blob,
|
||||||
const handle = await fileSave(
|
{
|
||||||
blob,
|
fileName: name,
|
||||||
{
|
description: "Excalidraw file",
|
||||||
fileName: name,
|
extensions: ["excalidraw"],
|
||||||
description: "Excalidraw file",
|
},
|
||||||
extensions: ["excalidraw"],
|
fileHandle || null,
|
||||||
},
|
);
|
||||||
fileHandle,
|
|
||||||
);
|
|
||||||
(window as any).handle = handle;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// "Save"
|
|
||||||
const writable = await fileHandle.createWritable();
|
|
||||||
await writable.write(blob);
|
|
||||||
await writable.close();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const loadFromJSON = async () => {
|
export const loadFromJSON = async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user