diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 0bbb5b629..42eee2857 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -912,7 +912,7 @@ define([ var toolbar = this.toolbar; if (this.api) { var isModified = this.api.asc_isDocumentCanSave(); - var isSyncButton = toolbar.btnSave.$icon.hasClass('btn-synch'); + var isSyncButton = toolbar.btnCollabChanges.$icon.hasClass('btn-synch'); if (!isModified && !isSyncButton && !toolbar.mode.forcesave) return; diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 7dfe2dbf9..76dc2a073 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -124,6 +124,7 @@ define([ signals: ['disabled'] }); this.toolbarControls.push(this.btnSave); + this.btnCollabChanges = this.btnSave; this.btnUndo = new Common.UI.Button({ id: 'id-toolbar-btn-undo', @@ -2116,21 +2117,21 @@ define([ /** coauthoring begin **/ onCollaborativeChanges: function () { if (this._state.hasCollaborativeChanges) return; - if (!this.btnSave.rendered || this._state.previewmode) { + if (!this.btnCollabChanges.rendered || this._state.previewmode) { this.needShowSynchTip = true; return; } this._state.hasCollaborativeChanges = true; - this.btnSave.$icon.removeClass(this.btnSaveCls).addClass('btn-synch'); + this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass('btn-synch'); if (this.showSynchTip) { - this.btnSave.updateHint(''); + this.btnCollabChanges.updateHint(''); if (this.synchTooltip === undefined) this.createSynchTip(); this.synchTooltip.show(); } else { - this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); + this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); } this.btnSave.setDisabled(false); @@ -2139,29 +2140,30 @@ define([ createSynchTip: function () { this.synchTooltip = new Common.UI.SynchronizeTip({ - target: $('#id-toolbar-btn-save') + target: this.btnCollabChanges.$el }); this.synchTooltip.on('dontshowclick', function () { this.showSynchTip = false; this.synchTooltip.hide(); - this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); + this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); Common.localStorage.setItem("de-hide-synch", 1); }, this); this.synchTooltip.on('closeclick', function () { this.synchTooltip.hide(); - this.btnSave.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); + this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S')); }, this); }, synchronizeChanges: function () { - if (!this._state.previewmode && this.btnSave.rendered) { + if ( !this._state.previewmode && this.btnCollabChanges.rendered ) { var me = this; - if ( me.btnSave.$icon.hasClass('btn-synch') ) { - me.btnSave.$icon.removeClass('btn-synch').addClass(me.btnSaveCls); + if ( me.btnCollabChanges.$icon.hasClass('btn-synch') ) { + me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(me.btnSaveCls); if (this.synchTooltip) this.synchTooltip.hide(); - this.btnSave.updateHint(this.btnSaveTip); + this.btnCollabChanges.updateHint(this.btnSaveTip); + this.btnSave.setDisabled(!me.mode.forcesave); this._state.hasCollaborativeChanges = false; } @@ -2175,16 +2177,18 @@ define([ editusers.push(item); }); + var me = this; var length = _.size(editusers); var cls = (length > 1) ? 'btn-save-coauth' : 'btn-save'; - if (cls !== this.btnSaveCls && this.btnSave.rendered) { - this.btnSaveTip = ((length > 1) ? this.tipSaveCoauth : this.tipSave ) + Common.Utils.String.platformKey('Ctrl+S'); + if ( cls !== me.btnSaveCls && me.btnCollabChanges.rendered ) { + me.btnSaveTip = ((length > 1) ? me.tipSaveCoauth : me.tipSave ) + Common.Utils.String.platformKey('Ctrl+S'); + + if ( !me.btnCollabChanges.$icon.hasClass('btn-synch') ) { + me.btnCollabChanges.$icon.removeClass(me.btnSaveCls).addClass(cls); + me.btnCollabChanges.updateHint(me.btnSaveTip); - if ( !this.btnSave.$icon.hasClass('btn-synch') ) { - this.btnSave.$icon.removeClass(this.btnSaveCls).addClass(cls); - this.btnSave.updateHint(this.btnSaveTip); } - this.btnSaveCls = cls; + me.btnSaveCls = cls; } },