From 095974e6338d494a155d5bb38f4659d789052d17 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Thu, 9 Jun 2016 10:33:21 -0400 Subject: [PATCH 1/2] Make uploadFile have a callback This should fix #80. --- src/app.js | 5 +++-- src/app/editor.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app.js b/src/app.js index 89fd2f14a6..5297cdbd28 100644 --- a/src/app.js +++ b/src/app.js @@ -163,8 +163,9 @@ var run = function () { for (var i = 0; i < fileList.length; i++) { var name = fileList[i].name; if (!window.localStorage[utils.fileKey(name)] || confirm('The file ' + name + ' already exists! Would you like to overwrite it?')) { - editor.uploadFile(fileList[i]); - updateFiles(); + editor.uploadFile(fileList[i], function () { + updateFiles(); + }); } } diff --git a/src/app/editor.js b/src/app/editor.js index 0c25d0b828..65e4b34e93 100644 --- a/src/app/editor.js +++ b/src/app/editor.js @@ -16,13 +16,14 @@ function Editor (loadingFromGist) { this.setCacheFileContent(''); }; - this.uploadFile = function (file) { + this.uploadFile = function (file, callback) { var fileReader = new FileReader(); SOL_CACHE_FILE = utils.fileKey(file.name); fileReader.onload = function (e) { window.localStorage[SOL_CACHE_FILE] = e.target.result; sessions[SOL_CACHE_FILE] = null; + callback(); }; fileReader.readAsText(file); }; From 93f003ac4445f72ecee71a96fcf341c26e0a7bbc Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Thu, 9 Jun 2016 11:17:55 -0400 Subject: [PATCH 2/2] Upload button is no longer the whole bar --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ed30036f65..0f7ee6337f 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,7 @@
-