Skip to content

Commit

Permalink
Fix #322 : Save As button no longer works on offline builds
Browse files Browse the repository at this point in the history
  • Loading branch information
juliandescottes committed Oct 24, 2015
1 parent 573d7ca commit c32b327
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/js/utils/FileUtilsDesktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@
deferred.resolve(fileInputElement.value);
};

fileInputElement.click();

fileInputElement.addEventListener('change', changeListener);
// there is no way to detect a cancelled fileInput popup
// as a crappy workaround we add a click listener on the document
// on top the change event listener
document.addEventListener('click', changeListener);
// fix for issue #322 :
window.setTimeout(function () {
fileInputElement.click();
fileInputElement.addEventListener('change', changeListener);
// there is no way to detect a cancelled fileInput popup
// as a crappy workaround we add a click listener on the document
// on top the change event listener
// todo : listen to dirty check instead
document.addEventListener('mousedown', changeListener);
}, 50);

return deferred.promise;
},
Expand Down

0 comments on commit c32b327

Please sign in to comment.