[DE] Don't show disconnect message on window close/reload

This commit is contained in:
Julia Radzhabova 2022-03-03 21:39:40 +03:00
parent 4d5cf5700e
commit d90a5cdd2f

View file

@ -1051,12 +1051,12 @@ define([
case Asc.c_oAscAsyncAction['Disconnect']: case Asc.c_oAscAsyncAction['Disconnect']:
text = this.textDisconnect; text = this.textDisconnect;
this.disableEditing(true, true); this.disableEditing(true, true);
if (!this._state.unload) { // don't show disconnect message on window close/reload
var me = this; var me = this;
statusCallback = function() { statusCallback = function() {
setTimeout(function(){
me.getApplication().getController('Statusbar').showDisconnectTip(); me.getApplication().getController('Statusbar').showDisconnectTip();
}, me._state.unloadTimer || 0);
}; };
}
break; break;
default: default:
@ -2058,16 +2058,18 @@ define([
if (this.api.isDocumentModified()) { if (this.api.isDocumentModified()) {
var me = this; var me = this;
this.api.asc_stopSaving(); this.api.asc_stopSaving();
this._state.unloadTimer = 1000;
this.continueSavingTimer = window.setTimeout(function() { this.continueSavingTimer = window.setTimeout(function() {
me.api.asc_continueSaving(); me.api.asc_continueSaving();
me._state.unloadTimer = 0;
}, 500); }, 500);
return this.leavePageText; return this.leavePageText;
} } else
this._state.unloadTimer = 10000;
}, },
onUnload: function() { onUnload: function() {
this._state.unload = true;
if (this.continueSavingTimer) clearTimeout(this.continueSavingTimer); if (this.continueSavingTimer) clearTimeout(this.continueSavingTimer);
}, },