mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix encoding of embed data & compress (#2240)
This commit is contained in:
parent
e8a39b5f84
commit
b3263c2a69
15 changed files with 483 additions and 122 deletions
|
@ -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],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue