From a371d53e635f1c0aa6097045ac5b59e78962f760 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 26 Jan 2017 22:21:07 -0500 Subject: Always unbind internal listeners when closing a modal dialog --- assets/js/components/file-upload.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'assets/js/components/file-upload.js') diff --git a/assets/js/components/file-upload.js b/assets/js/components/file-upload.js index 762eb6e1..f4445a44 100644 --- a/assets/js/components/file-upload.js +++ b/assets/js/components/file-upload.js @@ -2,7 +2,7 @@ KB.component('file-upload', function (containerElement, options) { var inputFileElement = null; var dropzoneElement = null; var files = []; - var currentFileIndex = null; + var currentFileIndex = 0; function onProgress(e) { if (e.lengthComputable) { @@ -183,6 +183,9 @@ KB.component('file-upload', function (containerElement, options) { this.render = function () { KB.on('modal.submit', onSubmit); + KB.on('modal.close', function () { + KB.removeListener('modal.submit', onSubmit); + }); inputFileElement = buildFileInputElement(); dropzoneElement = buildDropzoneElement(); -- cgit v1.2.3