Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/excalidraw/data/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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:
Expand All @@ -72,7 +72,7 @@ export const serializeAsJSON = (
undefined,
};

return JSON.stringify(data, null, 2);
return JSON.stringify(data, null, 4);
};

export const saveAsJSON = async (
Expand All @@ -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
Expand Down