浏览代码

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.
Mike Lewis 5 年之前
父节点
当前提交
5ce5e5ac1e
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/scene/data.ts

+ 1 - 1
src/scene/data.ts

@@ -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)
     );
   }
 }