Fix #322 : Save As button no longer works on offline builds

This commit is contained in:
jdescottes 2015-10-25 00:18:01 +02:00
parent 573d7ca051
commit c32b327f23

View File

@ -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;
},