DEV: Check for mobile upload button presence (#24059)

If rendering would break before `_bindMobileUploadButton` - this would fail too, obscuring the original issue.
This commit is contained in:
Jarek Radosz 2023-10-23 23:14:17 +02:00 committed by GitHub
parent ebeb07f6c3
commit b3caa90f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -634,21 +634,23 @@ export default Mixin.create(ExtendableUploader, UppyS3Multipart, {
this.mobileUploadButton = document.getElementById(
this.mobileFileUploaderId
);
this.mobileUploadButtonEventListener = () => {
document.getElementById(this.fileUploadElementId).click();
};
this.mobileUploadButton.addEventListener(
this.mobileUploadButton?.addEventListener(
"click",
this.mobileUploadButtonEventListener,
this._mobileUploadButtonEventListener,
false
);
}
},
@bind
_mobileUploadButtonEventListener() {
document.getElementById(this.fileUploadElementId).click();
},
_unbindMobileUploadButton() {
this.mobileUploadButton?.removeEventListener(
"click",
this.mobileUploadButtonEventListener
this._mobileUploadButtonEventListener
);
},