From ecbe84025f9f604dff89cb28df09f9ca5bac897b Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 12 May 2017 09:02:33 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20editor=20image=20uploads?= =?UTF-8?q?=20in=20Edge=20(#687)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue - babel's transpilation of the `for...of` loops was resulting in an error in MS Edge, dropping back to an old `for` loop fixed it --- ghost/admin/app/components/gh-uploader.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ghost/admin/app/components/gh-uploader.js b/ghost/admin/app/components/gh-uploader.js index 7bdf6457c3..2adeceb731 100644 --- a/ghost/admin/app/components/gh-uploader.js +++ b/ghost/admin/app/components/gh-uploader.js @@ -106,7 +106,10 @@ export default Component.extend({ let ok = []; let errors = []; - for (let file of files) { + // NOTE: for...of loop results in a transpilation that errors in Edge, + // once we drop IE11 support we should be able to use native for...of + for (let i = 0; i < files.length; i++) { + let file = files[i]; let result = validate(file); if (result === true) { ok.push(file); @@ -147,8 +150,10 @@ export default Component.extend({ this.onStart(); - for (let file of files) { - uploads.push(this.get('_uploadFile').perform(file)); + // NOTE: for...of loop results in a transpilation that errors in Edge, + // once we drop IE11 support we should be able to use native for...of + for (let i = 0; i < files.length; i++) { + uploads.push(this.get('_uploadFile').perform(files[i])); } // populates this.errors and this.uploadUrls