diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 92e50bca3..5c119aa79 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -966,6 +966,7 @@ define([ } if ( id == Asc.c_oAscAsyncAction['Disconnect']) { + this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); this.disableEditing(false, true); this.getApplication().getController('Statusbar').hideDisconnectTip(); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); @@ -1073,7 +1074,9 @@ define([ this.disableEditing(true, true); var me = this; statusCallback = function() { - me.getApplication().getController('Statusbar').showDisconnectTip(); + me._state.timerDisconnect = setTimeout(function(){ + me.getApplication().getController('Statusbar').showDisconnectTip(); + }, me._state.unloadTimer || 0); }; break; @@ -2082,12 +2085,15 @@ define([ if (this.api.isDocumentModified()) { var me = this; this.api.asc_stopSaving(); + this._state.unloadTimer = 1000; this.continueSavingTimer = window.setTimeout(function() { me.api.asc_continueSaving(); + me._state.unloadTimer = 0; }, 500); return this.leavePageText; - } + } else + this._state.unloadTimer = 10000; }, onUnload: function() { diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index ed6371244..13bda0005 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -629,6 +629,7 @@ define([ this.synchronizeChanges(); if ( id == Asc.c_oAscAsyncAction['Disconnect']) { + this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); this.disableEditing(false, true); this.getApplication().getController('Statusbar').hideDisconnectTip(); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); @@ -726,7 +727,9 @@ define([ this.disableEditing(true, true); var me = this; statusCallback = function() { - me.getApplication().getController('Statusbar').showDisconnectTip(); + me._state.timerDisconnect = setTimeout(function(){ + me.getApplication().getController('Statusbar').showDisconnectTip(); + }, me._state.unloadTimer || 0); }; break; @@ -1700,12 +1703,15 @@ define([ if (this.api.isDocumentModified()) { var me = this; this.api.asc_stopSaving(); + this._state.unloadTimer = 1000; this.continueSavingTimer = window.setTimeout(function() { me.api.asc_continueSaving(); + me._state.unloadTimer = 0; }, 500); return this.leavePageText; - } + } else + this._state.unloadTimer = 10000; }, onUnload: function() { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index c0de9fa47..15870d086 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -714,6 +714,7 @@ define([ this.onEditComplete(this.loadMask, {restorefocus:true}); } if ( id == Asc.c_oAscAsyncAction['Disconnect']) { + this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); this.disableEditing(false, true); this.getApplication().getController('Statusbar').hideDisconnectTip(); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); @@ -800,7 +801,9 @@ define([ this.disableEditing(true, true); var me = this; statusCallback = function() { - me.getApplication().getController('Statusbar').showDisconnectTip(); + me._state.timerDisconnect = setTimeout(function(){ + me.getApplication().getController('Statusbar').showDisconnectTip(); + }, me._state.unloadTimer || 0); }; break; @@ -2069,12 +2072,15 @@ define([ if (isEdit && this.api.asc_isDocumentModified()) { var me = this; this.api.asc_stopSaving(); + this._state.unloadTimer = 1000; this.continueSavingTimer = window.setTimeout(function() { me.api.asc_continueSaving(); + me._state.unloadTimer = 0; }, 500); return this.leavePageText; - } + } else + this._state.unloadTimer = 10000; }, onUnload: function() {