Skip to content

Commit

Permalink
Call clearInputs on uppyService
Browse files Browse the repository at this point in the history
  • Loading branch information
JanAckermann committed May 24, 2022
1 parent 1058bc1 commit 42757b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
13 changes: 2 additions & 11 deletions packages/web-app-files/src/components/AppBar/CreateAndUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ export default defineComponent({
const quotaExceeded = this.checkQuotaExceeded(uppyResources)
if (quotaExceeded) {
return this.clearInputs()
return this.$uppyService.clearInputs()
}
for (const file of uppyResources) {
Expand Down Expand Up @@ -813,7 +813,7 @@ export default defineComponent({
cancelText: this.$gettext('Cancel'),
confirmText: isVersioningEnabled ? this.$gettext('Create') : this.$gettext('Overwrite'),
onCancel: () => {
this.clearInputs()
this.$uppyService.clearInputs()
this.hideModal()
},
onConfirm: () => {
Expand All @@ -824,15 +824,6 @@ export default defineComponent({
this.createModal(modal)
},
clearInputs() {
return [
this.$refs['folder-upload'].$refs.input,
this.$refs['file-upload'].$refs.input
].forEach((item) => {
item.value = null
})
}
}
})
</script>
Expand Down
14 changes: 8 additions & 6 deletions packages/web-runtime/src/services/uppyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,11 @@ export class UppyService {
result.failed.forEach((file) => {
this.publish('uploadError', file)
})
this.uploadInputs.forEach((item) => {
item.value = null
})
this.clearInputs()
})
this.uppy.on('file-removed', () => {
this.publish('uploadRemoved')
this.uploadInputs.forEach((item) => {
item.value = null
})
this.clearInputs()
})
this.uppy.on('file-added', (file) => {
this.publish('fileAdded')
Expand Down Expand Up @@ -258,4 +254,10 @@ export class UppyService {
}
})
}

clearInputs() {
this.uploadInputs.forEach((item) => {
item.value = null
})
}
}

0 comments on commit 42757b9

Please sign in to comment.