diff --git a/packages/@uppy/core/src/index.js b/packages/@uppy/core/src/index.js index 9fe1944c5..86dfbaa1b 100644 --- a/packages/@uppy/core/src/index.js +++ b/packages/@uppy/core/src/index.js @@ -711,7 +711,7 @@ class Uppy { } } - removeFiles (fileIDs) { + removeFiles (fileIDs, reason) { const { files, currentUploads } = this.getState() const updatedFiles = { ...files } const updatedUploads = { ...currentUploads } @@ -764,7 +764,7 @@ class Uppy { const removedFileIDs = Object.keys(removedFiles) removedFileIDs.forEach((fileID) => { - this.emit('file-removed', removedFiles[fileID]) + this.emit('file-removed', removedFiles[fileID], reason) }) if (removedFileIDs.length > 5) { @@ -774,8 +774,8 @@ class Uppy { } } - removeFile (fileID) { - this.removeFiles([fileID]) + removeFile (fileID, reason = null) { + this.removeFiles([fileID], reason) } pauseResume (fileID) { @@ -866,7 +866,7 @@ class Uppy { const fileIDs = Object.keys(files) if (fileIDs.length) { - this.removeFiles(fileIDs) + this.removeFiles(fileIDs, 'cancel-all') } this.setState({ diff --git a/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.js b/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.js index c616a6b00..b804174ad 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.js +++ b/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.js @@ -112,7 +112,7 @@ module.exports = function Buttons (props) { i18n={i18n} info={props.info} log={props.log} - onClick={() => removeFile(file.id)} + onClick={() => removeFile(file.id, 'removed-by-user')} /> ) : null}