diff --git a/apps/common/main/lib/component/SynchronizeTip.js b/apps/common/main/lib/component/SynchronizeTip.js index 1e1e0eadb3..61c6662256 100644 --- a/apps/common/main/lib/component/SynchronizeTip.js +++ b/apps/common/main/lib/component/SynchronizeTip.js @@ -190,6 +190,13 @@ define([ return this.cmpEl && this.cmpEl.is(':visible'); }, + setText: function(text) { + if (this.text !== text) { + this.text = text; + this.cmpEl.find('.tip-text').text(text); + } + }, + textDontShow : 'Don\'t show this message again', textSynchronize : 'The document has been changed by another user.
Please click to save your changes and reload the updates.' } diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index ef3e9e63a3..43117c39d3 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -785,8 +785,9 @@ define([ return"#"+("000000"+color.toString(16)).substr(-6); }, - disableEditing: function(disable, temp) { - var app = this.getApplication(); + disableEditing: function(disable, type) { + var app = this.getApplication(), + temp = type==='reconnect' || type==='refresh-file'; Common.NotificationCenter.trigger('editing:disable', disable, { viewMode: disable, reviewMode: false, @@ -807,7 +808,7 @@ define([ toolbar: true, plugins: false, protect: false - }, temp ? 'reconnect' : 'disconnect'); + }, temp ? type : 'disconnect'); }, onEditingDisable: function(disable, options, type) { @@ -1006,9 +1007,13 @@ define([ if ( id == Asc.c_oAscAsyncAction['Disconnect']) { this._state.timerDisconnect && clearTimeout(this._state.timerDisconnect); - this.disableEditing(false, true); + this.disableEditing(false, 'reconnect'); this.getApplication().getController('Statusbar').hideDisconnectTip(); this.getApplication().getController('Statusbar').setStatusCaption(this.textReconnect); + } else if (id === Asc.c_oAscAsyncAction['RefreshFile']) { + this.disableEditing(false, 'refresh-file'); + this.getApplication().getController('Statusbar').hideDisconnectTip(); + this.getApplication().getController('Statusbar').setStatusCaption(''); } if ( type == Asc.c_oAscAsyncActionType.BlockInteraction && @@ -1111,7 +1116,7 @@ define([ case Asc.c_oAscAsyncAction['Disconnect']: text = this.textDisconnect; Common.UI.Menu.Manager.hideAll(); - this.disableEditing(true, true); + this.disableEditing(true, 'reconnect'); var me = this; statusCallback = function() { me._state.timerDisconnect = setTimeout(function(){ @@ -1120,6 +1125,13 @@ define([ }; break; + case Asc.c_oAscAsyncAction['RefreshFile']: + text = this.textUpdating; + Common.UI.Menu.Manager.hideAll(); + this.disableEditing(true, 'refresh-file'); + this.getApplication().getController('Statusbar').showDisconnectTip(this.textUpdateVersion); + break; + default: if (typeof action.id == 'string'){ title = action.id; @@ -2780,7 +2792,7 @@ define([ warningDocumentIsLocked: function() { var me = this; var _disable_ui = function (disable) { - me.disableEditing(disable, true); + me.disableEditing(disable, 'reconnect'); }; Common.Utils.warningDocumentIsLocked({disablefunc: _disable_ui}); @@ -3443,7 +3455,9 @@ define([ errorInconsistentExtPdf: 'An error has occurred while opening the file.
The file content corresponds to one of the following formats: pdf/djvu/xps/oxps, but the file has the inconsistent extension: %1.', errorInconsistentExt: 'An error has occurred while opening the file.
The file content does not match the file extension.', errorCannotPasteImg: 'We can\'t paste this image from the Clipboard, but you can save it to your device and \ninsert it from there, or you can copy the image without text and paste it into the document.', - textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.
Do you want to continue?' + textTryQuickPrint: 'You have selected Quick print: the entire document will be printed on the last selected or default printer.
Do you want to continue?', + textUpdating: 'Updating', + textUpdateVersion: 'The file version has been changed. Please wait...', } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Statusbar.js b/apps/documenteditor/main/app/controller/Statusbar.js index 8f66296289..596ac29721 100644 --- a/apps/documenteditor/main/app/controller/Statusbar.js +++ b/apps/documenteditor/main/app/controller/Statusbar.js @@ -323,14 +323,15 @@ define([ return tip; }, - showDisconnectTip: function () { + showDisconnectTip: function (text) { var me = this; + text = text || this.textDisconnect; if (!this.disconnectTip) { var target = this.statusbar.getStatusLabel(); target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body); this.disconnectTip = new Common.UI.SynchronizeTip({ target : target, - text : this.textDisconnect, + text : text, placement: 'top', position: this.statusbar.isVisible() ? undefined : {bottom: 0}, showLink: false, @@ -342,6 +343,8 @@ define([ me.disconnectTip = null; } }); + } else { + this.disconnectTip.setText(text); } this.disconnectTip.show(); },