Adjust type of data URI when saving (#452)

Previously the type used for the data URI when saving was text/plain.
On iPad, this caused the file to automatically have a .txt extension
added (so files ended up with names like "drawing-xyz.json.txt"). This
meant that the files couldn't be loaded by the tool, which expects only
files with a .json extension.

Now, the type used is application/json, which means that the files get
saved with the correct extension and can be successfully loaded on iPad.
This commit is contained in:
Mike Lewis 2020-01-19 21:15:40 +00:00 committed by Lipis
parent d505c6615d
commit 5ce5e5ac1e

View File

@ -96,7 +96,7 @@ export async function saveAsJSON(
} else {
saveFile(
name,
"data:text/plain;charset=utf-8," + encodeURIComponent(serialized)
"data:application/json;charset=utf-8," + encodeURIComponent(serialized)
);
}
}