Issue #277 : Fix FF bug showing native save popup despite preventDefault

This commit is contained in:
jdescottes 2015-10-01 01:06:54 +02:00
parent a286d5926a
commit 669d7a21cb

View File

@ -54,14 +54,20 @@
// no other implementation for now
};
ns.StorageService.prototype.onSaveKey_ = function () {
ns.StorageService.prototype.onSaveKey_ = function (charkey) {
var piskel = this.piskelController.getPiskel();
if (pskl.app.isLoggedIn()) {
this.saveToGallery(this.piskelController.getPiskel());
} else if (pskl.utils.Environment.detectNodeWebkit()) {
this.saveToDesktop(this.piskelController.getPiskel());
} else {
this.saveToLocalStorage(this.piskelController.getPiskel());
// saveToLocalStorage might display a native confirm dialog
// on Firefox, the native 'save' window will then be displayed
// wrap in timeout in order to start saving only after event.preventDefault
// has been done
window.setTimeout(function () {
this.saveToLocalStorage(this.piskelController.getPiskel());
}.bind(this), 0);
}
};