[DE] Fix Bug 35757. Disable save button in the preview mode for review.

This commit is contained in:
Julia Radzhabova 2017-09-01 17:48:31 +03:00
parent cfed1c50b8
commit e86804cbb2
3 changed files with 20 additions and 7 deletions

View file

@ -566,7 +566,7 @@ define([
}
application.getController('DocumentHolder').getView().focus();
if (this.api) {
if (this.api && !toolbarView._state.previewmode) {
var cansave = this.api.asc_isDocumentCanSave(),
forcesave = this.appOptions.forcesave;
var isSyncButton = $('.icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch');
@ -1393,7 +1393,7 @@ define([
var toolbarView = this.getApplication().getController('Toolbar').getView();
if (toolbarView) {
if (toolbarView && !toolbarView._state.previewmode) {
var isSyncButton = $('.icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
forcesave = this.appOptions.forcesave;
if (toolbarView.btnSave.isDisabled() !== (!isModified && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))
@ -1411,7 +1411,7 @@ define([
toolbarController = application.getController('Toolbar'),
toolbarView = toolbarController.getView();
if (toolbarView && this.api) {
if (toolbarView && this.api && !toolbarView._state.previewmode) {
var isSyncButton = $('.icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
forcesave = this.appOptions.forcesave;
if (toolbarView.btnSave.isDisabled() !== (!isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))

View file

@ -2775,10 +2775,18 @@ define([
disable = disable || (reviewmode ? toolbar_mask.length>0 : group_mask.length>0);
toolbar.$el.find('.toolbar').toggleClass('masked', disable);
toolbar.btnHide.setDisabled(disable);
disable ? Common.util.Shortcuts.suspendEvents('alt+h') : Common.util.Shortcuts.resumeEvents('alt+h');
if ( toolbar.synchTooltip )
toolbar.synchTooltip.hide();
toolbar._state.previewmode = reviewmode && disable;
if (reviewmode) {
toolbar._state.previewmode && toolbar.btnSave.setDisabled(toolbar._state.previewmode);
if (toolbar.needShowSynchTip) {
toolbar.needShowSynchTip = false;
toolbar.onCollaborativeChanges();
}
}
disable ? Common.util.Shortcuts.suspendEvents('alt+h') : Common.util.Shortcuts.resumeEvents('alt+h');
},
onSelectRecepientsClick: function() {

View file

@ -103,7 +103,8 @@ define([
this.toolbarControls = [];
this.textOnlyControls = [];
this._state = {
hasCollaborativeChanges: undefined
hasCollaborativeChanges: undefined,
previewmode: false
};
this.btnSaveCls = 'btn-save';
this.btnSaveTip = this.tipSave + Common.Utils.String.platformKey('Ctrl+S');
@ -2202,6 +2203,10 @@ define([
this.needShowSynchTip = true;
return;
}
if (this._state.previewmode) {
if (!DE.getController('Main')._state.fastCoauth) this.needShowSynchTip = true;
return;
}
this._state.hasCollaborativeChanges = true;
var iconEl = $('.icon', this.btnSave.cmpEl);
@ -2238,7 +2243,7 @@ define([
},
synchronizeChanges: function () {
if (this.btnSave.rendered) {
if (!this._state.previewmode && this.btnSave.rendered) {
var iconEl = $('.icon', this.btnSave.cmpEl);
if (iconEl.hasClass('btn-synch')) {