fix encoding of embed data & compress (#2240)

This commit is contained in:
David Luzar
2020-10-15 21:31:21 +02:00
committed by GitHub
parent e8a39b5f84
commit b3263c2a69
15 changed files with 483 additions and 122 deletions

View File

@ -138,19 +138,22 @@ export class API {
return element as any;
};
static dropFile(sceneData: ImportedDataState) {
static dropFile(data: ImportedDataState | Blob) {
const fileDropEvent = createEvent.drop(GlobalTestState.canvas);
const file = new Blob(
[
JSON.stringify({
type: "excalidraw",
...sceneData,
}),
],
{
type: "application/json",
},
);
const file =
data instanceof Blob
? data
: new Blob(
[
JSON.stringify({
type: "excalidraw",
...data,
}),
],
{
type: "application/json",
},
);
Object.defineProperty(fileDropEvent, "dataTransfer", {
value: {
files: [file],