Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

Null file handle doesn’t need to be passed (#1752)

Thomas Steiner3cee0768cc0c
diff --git a/src/data/json.ts b/src/data/json.ts
index 5eb68a5211..3dbadde56f 100644
--- a/src/data/json.ts
+++ b/src/data/json.ts
@@ -30,25 +30,16 @@ export const saveAsJSON = async (
const blob = new Blob([serialized], {
type: "application/json",
});
- // Either "Save as" or non-supporting browser
- if (!fileHandle) {
- const name = `${appState.name}.excalidraw`;
- const handle = await fileSave(
- blob,
- {
- fileName: name,
- description: "Excalidraw file",
- extensions: ["excalidraw"],
- },
- fileHandle,
- );
- (window as any).handle = handle;
- return;
- }
- // "Save"
- const writable = await fileHandle.createWritable();
- await writable.write(blob);
- await writable.close();
+ const name = `${appState.name}.excalidraw`;
+ (window as any).handle = await fileSave(
+ blob,
+ {
+ fileName: name,
+ description: "Excalidraw file",
+ extensions: ["excalidraw"],
+ },
+ fileHandle || null,
+ );
};
export const loadFromJSON = async () => {