Skip to content

Commit

Permalink
minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulosabayomi committed Mar 7, 2024
1 parent f4963ca commit f565742
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## 1.1.5 (2024-03-05)
## 1.1.6 (2024-03-06)

- Fix: An undefined variable bug caused by the method that returns the attached form field as an HTML element or undefined if not provided.

## 1.1.5 (2024-03-06)

- Fix: Typescript bugs caused by not setting optional options as optional.

Expand Down
2 changes: 1 addition & 1 deletion core/custupCore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ export default class CustUpCore extends EventTarget {
* @method upload - the method to upload file to the endpoint
* @param {string | undefined} file_id - the id of the file to upload in the case of a single file, all the files will be uploaded serially if not provided
*/
upload(file_id: string | undefined): void;
upload(file_id?: string | undefined): void;
/**
* @method retry_upload - to retry uploading a file
* @param {string} file_id - the id of the file to retry
Expand Down
2 changes: 1 addition & 1 deletion core/custupCore.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions core/custupCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,7 @@ export default class CustUpCore extends EventTarget {
attached_files.map(file => _class.file_upload_form_data.append(_class.options.file_upload_settings.files_field_name, file))

const all_files = [...this.selectedFiles, ...attached_files];
const beforeUploadStartCheck = this.triggerEvent('upload_beforeStart', {files: all_files, formData: _class.file_upload_form_data, form: form_field})
const beforeUploadStartCheck = this.triggerEvent('upload_beforeStart', {files: all_files, formData: _class.file_upload_form_data, form: this.get_attached_form_field()})
if (!beforeUploadStartCheck) {
this.show_message("Please check that all requirements have been satisfied", "error");
return;
Expand Down Expand Up @@ -1975,7 +1975,7 @@ export default class CustUpCore extends EventTarget {
* @private @method get_attached_form_field
*/
get_attached_form_field () {
return !_class.options.file_upload_settings.form_field ? undefined : document.querySelector(_class.options.file_upload_settings.form_field);
return !this.options.file_upload_settings.form_field ? undefined : document.querySelector(this.options.file_upload_settings.form_field);
}

/**
Expand Down Expand Up @@ -2144,7 +2144,7 @@ export default class CustUpCore extends EventTarget {
* @method upload - the method to upload file to the endpoint
* @param {string | undefined} file_id - the id of the file to upload in the case of a single file, all the files will be uploaded serially if not provided
*/
upload (file_id) {
upload (file_id=undefined) {
const file = this.selectedFiles.find(fl => fl.id == file_id)
this.fileUploadHandler(file);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custup",
"version": "1.1.5",
"version": "1.1.6",
"description": "Highly customisable file upload library with zero dependencies",
"main": "src/custup.min.js",
"scripts": {
Expand Down

0 comments on commit f565742

Please sign in to comment.