fix: don't crash on drop highlighted text onto canvas (#4890)

This commit is contained in:
Tom Milligan 2022-03-09 10:51:13 +00:00 committed by GitHub
parent 20de06ef50
commit 4d5f00ff08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -213,9 +213,12 @@ export class API {
}
});
const files = [blob] as File[] & { item: (index: number) => File };
files.item = (index: number) => files[index];
Object.defineProperty(fileDropEvent, "dataTransfer", {
value: {
files: [blob],
files,
getData: (type: string) => {
if (type === blob.type) {
return text;