diff --git a/packages/excalidraw/data/json.ts b/packages/excalidraw/data/json.ts index b8fb0f62cc99..1a2b68b2019a 100644 --- a/packages/excalidraw/data/json.ts +++ b/packages/excalidraw/data/json.ts @@ -36,7 +36,7 @@ const filterOutDeletedFiles = ( const nextFiles: BinaryFiles = {}; for (const element of elements) { if ( - !element.isDeleted && + element.isDeleted && "fileId" in element && element.fileId && files[element.fileId] @@ -54,7 +54,7 @@ export const serializeAsJSON = ( type: "local" | "database", ): string => { const data: ExportedDataState = { - type: EXPORT_DATA_TYPES.excalidraw, + type: EXPORT_DATA_TYPES.excalidrawlib, version: VERSIONS.excalidraw, source: getExportSource(), elements: @@ -72,7 +72,7 @@ export const serializeAsJSON = ( undefined, }; - return JSON.stringify(data, null, 2); + return JSON.stringify(data, null, 4); }; export const saveAsJSON = async ( @@ -84,12 +84,12 @@ export const saveAsJSON = async ( ) => { const serialized = serializeAsJSON(elements, appState, files, "local"); const blob = new Blob([serialized], { - type: MIME_TYPES.excalidraw, + type: MIME_TYPES.json, }); const fileHandle = await fileSave(blob, { name, - extension: "excalidraw", + extension: "json", description: "Excalidraw file", fileHandle: isImageFileHandle(appState.fileHandle) ? null