Skip to content

Commit

Permalink
some cleanup after #194 fix (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tewr authored Jul 20, 2023
1 parent b159a32 commit 89889d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
10 changes: 4 additions & 6 deletions src/Blazor.FileReader/script/DragnDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,10 @@ function RegisterDropEvents(this: FileReaderComponent, element: HTMLElement, reg
const filePromise = new Promise<FileList>(async (resolve, reject) => {
try {
let files = await getFilesAsync(ev.dataTransfer);
if (registerOptions.additive) {
if (existingFilePromise) {
const existing = await existingFilePromise ?? new FileList();
if (existing.length > 0) {
files = new ConcatFileList(existing, files);
}
if (registerOptions.additive && existingFilePromise) {
const existing = await existingFilePromise ?? new FileList();
if (existing.length > 0) {
files = new ConcatFileList(existing, files);
}
}
resolve(files);
Expand Down
10 changes: 4 additions & 6 deletions src/Blazor.FileReader/wwwroot/FileReaderComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,10 @@
var _a;
try {
let files = yield getFilesAsync(ev.dataTransfer);
if (registerOptions.additive) {
if (existingFilePromise) {
const existing = (_a = yield existingFilePromise) !== null && _a !== void 0 ? _a : new FileList();
if (existing.length > 0) {
files = new ConcatFileList_1.ConcatFileList(existing, files);
}
if (registerOptions.additive && existingFilePromise) {
const existing = (_a = yield existingFilePromise) !== null && _a !== void 0 ? _a : new FileList();
if (existing.length > 0) {
files = new ConcatFileList_1.ConcatFileList(existing, files);
}
}
resolve(files);
Expand Down
Loading

0 comments on commit 89889d2

Please sign in to comment.