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);
};