DEV: Add uppyReady hook to uppy mixins (#15361)

This should be overridden in a child component if you need to
hook into uppy events and be sure that everything is already
set up for _uppyInstance.
This commit is contained in:
Martin Brennan 2021-12-20 11:00:20 +10:00 committed by GitHub
parent 2d68e5d942
commit 1cdb5b7e4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -337,8 +337,14 @@ export default Mixin.create(ExtendableUploader, UppyS3Multipart, {
this._setupUIPlugins();
this.uploadTargetBound = true;
this._uppyReady();
},
// This should be overridden in a child component if you need to
// hook into uppy events and be sure that everything is already
// set up for _uppyInstance.
_uppyReady() {},
@bind
_handleUploadError(file, error, response) {
this._removeInProgressUpload(file.id);

View File

@ -224,8 +224,15 @@ export default Mixin.create(UppyS3Multipart, {
this._useXHRUploads();
}
}
this._uppyReady();
},
// This should be overridden in a child component if you need to
// hook into uppy events and be sure that everything is already
// set up for _uppyInstance.
_uppyReady() {},
_startUpload() {
if (!this.filesAwaitingUpload) {
return;
@ -233,6 +240,7 @@ export default Mixin.create(UppyS3Multipart, {
if (!this._uppyInstance?.getFiles().length) {
return;
}
this.set("uploading", true);
return this._uppyInstance?.upload();
},