Don't show disconnect message on window close/reload

This commit is contained in:
Julia Radzhabova 2022-03-14 13:11:07 +03:00
parent 8323ac2934
commit a5dfe42751
3 changed files with 24 additions and 6 deletions

View file

@ -966,6 +966,7 @@ define([
} }
if ( id == Asc.c_oAscAsyncAction['Disconnect']) { if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect);
this.disableEditing(false, true); this.disableEditing(false, true);
this.getApplication().getController('Statusbar').hideDisconnectTip(); this.getApplication().getController('Statusbar').hideDisconnectTip();
this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect);
@ -1073,7 +1074,9 @@ define([
this.disableEditing(true, true); this.disableEditing(true, true);
var me = this; var me = this;
statusCallback = function() { statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip(); me._state.timerDisconnect = setTimeout(function(){
me.getApplication().getController('Statusbar').showDisconnectTip();
}, me._state.unloadTimer || 0);
}; };
break; break;
@ -2082,12 +2085,15 @@ 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() {

View file

@ -629,6 +629,7 @@ define([
this.synchronizeChanges(); this.synchronizeChanges();
if ( id == Asc.c_oAscAsyncAction['Disconnect']) { if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect);
this.disableEditing(false, true); this.disableEditing(false, true);
this.getApplication().getController('Statusbar').hideDisconnectTip(); this.getApplication().getController('Statusbar').hideDisconnectTip();
this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect);
@ -726,7 +727,9 @@ define([
this.disableEditing(true, true); this.disableEditing(true, true);
var me = this; var me = this;
statusCallback = function() { statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip(); me._state.timerDisconnect = setTimeout(function(){
me.getApplication().getController('Statusbar').showDisconnectTip();
}, me._state.unloadTimer || 0);
}; };
break; break;
@ -1700,12 +1703,15 @@ 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() {

View file

@ -714,6 +714,7 @@ define([
this.onEditComplete(this.loadMask, {restorefocus:true}); this.onEditComplete(this.loadMask, {restorefocus:true});
} }
if ( id == Asc.c_oAscAsyncAction['Disconnect']) { if ( id == Asc.c_oAscAsyncAction['Disconnect']) {
this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect);
this.disableEditing(false, true); this.disableEditing(false, true);
this.getApplication().getController('Statusbar').hideDisconnectTip(); this.getApplication().getController('Statusbar').hideDisconnectTip();
this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect);
@ -800,7 +801,9 @@ define([
this.disableEditing(true, true); this.disableEditing(true, true);
var me = this; var me = this;
statusCallback = function() { statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip(); me._state.timerDisconnect = setTimeout(function(){
me.getApplication().getController('Statusbar').showDisconnectTip();
}, me._state.unloadTimer || 0);
}; };
break; break;
@ -2069,12 +2072,15 @@ define([
if (isEdit && this.api.asc_isDocumentModified()) { if (isEdit && this.api.asc_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() {