Skip to content

Commit

Permalink
feat: extract public api to the composition class
Browse files Browse the repository at this point in the history
  • Loading branch information
nd0ut committed Jun 24, 2024
1 parent 185dda5 commit 6de876f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions abstract/UploaderPublicApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,26 @@ export class UploaderPublicApi {
'The value of `accept` will be concatenated with the internal image mime types list.',
);
}
this.fileInput = document.createElement('input');
this.fileInput.type = 'file';
this.fileInput.multiple = this.cfg.multiple;
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.multiple = this.cfg.multiple;
if (options.captureCamera) {
this.fileInput.capture = this.cfg.cameraCapture;
this.fileInput.accept = 'image/*';
fileInput.capture = this.cfg.cameraCapture;
fileInput.accept = 'image/*';
} else {
this.fileInput.accept = accept;
fileInput.accept = accept;
}
this.fileInput.dispatchEvent(new MouseEvent('click'));
this.fileInput.onchange = () => {
fileInput.dispatchEvent(new MouseEvent('click'));
fileInput.onchange = () => {
// @ts-ignore TODO: fix this
[...this.fileInput['files']].forEach((file) =>
[...fileInput['files']].forEach((file) =>
this.addFileFromObject(file, { source: options.captureCamera ? UploadSource.CAMERA : UploadSource.LOCAL }),
);
// To call uploadTrigger UploadList should draw file items first:
this._ctx.$['*currentActivity'] = ActivityBlock.activities.UPLOAD_LIST;
this._ctx.setOrAddState('*modalActive', true);
// @ts-ignore TODO: fix this
this.fileInput['value'] = '';
this.fileInput = null;
fileInput['value'] = '';
};
}

Expand Down

0 comments on commit 6de876f

Please sign in to comment.