[DE] Disable comments on toolbar when objects are locked.

[PE] Disable comments on toolbar when no slides.
This commit is contained in:
Julia Radzhabova 2017-06-29 15:06:31 +03:00
parent 32a688e910
commit 64355cc7db
2 changed files with 3 additions and 7 deletions

View file

@ -728,7 +728,7 @@ define([
if (toolbar.listStylesAdditionalMenuItem && (frame_pr===undefined) !== toolbar.listStylesAdditionalMenuItem.isDisabled()) if (toolbar.listStylesAdditionalMenuItem && (frame_pr===undefined) !== toolbar.listStylesAdditionalMenuItem.isDisabled())
toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined); toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined);
need_disable = paragraph_locked || header_locked || in_chart || this.api.can_AddQuotedComment()===false; need_disable = (paragraph_locked || header_locked) && this.api.can_AddQuotedComment() || image_locked;
if (this.btnsComment && this.btnsComment.length>0 && need_disable != this.btnsComment[0].isDisabled()) if (this.btnsComment && this.btnsComment.length>0 && need_disable != this.btnsComment[0].isDisabled())
_.each (this.btnsComment, function(item){ _.each (this.btnsComment, function(item){
item.setDisabled(need_disable); item.setDisabled(need_disable);
@ -2810,7 +2810,6 @@ define([
if ( this.btnsComment.length ) { if ( this.btnsComment.length ) {
var _comments = DE.getController('Common.Controllers.Comments').getView(); var _comments = DE.getController('Common.Controllers.Comments').getView();
Array.prototype.push.apply(me.toolbar.paragraphControls, this.btnsComment);
this.btnsComment.forEach(function (btn) { this.btnsComment.forEach(function (btn) {
btn.updateHint( _comments.textAddComment ); btn.updateHint( _comments.textAddComment );
btn.on('click', function (btn, e) { btn.on('click', function (btn, e) {

View file

@ -650,11 +650,9 @@ define([
if (shape_locked!==undefined && this._state.shapecontrolsdisable !== shape_locked) { if (shape_locked!==undefined && this._state.shapecontrolsdisable !== shape_locked) {
if (this._state.activated) this._state.shapecontrolsdisable = shape_locked; if (this._state.activated) this._state.shapecontrolsdisable = shape_locked;
this.toolbar.lockToolbar(PE.enumLock.shapeLock, shape_locked, {array: me.toolbar.shapeControls.concat(me.toolbar.paragraphControls).concat(me.btnsComment)}); this.toolbar.lockToolbar(PE.enumLock.shapeLock, shape_locked, {array: me.toolbar.shapeControls.concat(me.toolbar.paragraphControls)});
} }
this.toolbar.lockToolbar(PE.enumLock.commentLock, this.api.can_AddQuotedComment() === false, { array: this.btnsComment });
if (this._state.no_object !== no_object ) { if (this._state.no_object !== no_object ) {
if (this._state.activated) this._state.no_object = no_object; if (this._state.activated) this._state.no_object = no_object;
this.toolbar.lockToolbar(PE.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnShapeAlign, me.toolbar.btnShapeArrange ]}); this.toolbar.lockToolbar(PE.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnShapeAlign, me.toolbar.btnShapeArrange ]});
@ -2074,7 +2072,7 @@ define([
var button = new Common.UI.Button({ var button = new Common.UI.Button({
cls: _cls, cls: _cls,
iconCls: 'btn-menu-comments', iconCls: 'btn-menu-comments',
lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.shapeLock, _set.commentLock], lock: [_set.lostConnect, _set.noSlides],
caption: me.toolbar.capBtnComment caption: me.toolbar.capBtnComment
}).render( slots.eq(index) ); }).render( slots.eq(index) );
@ -2084,7 +2082,6 @@ define([
if ( this.btnsComment.length ) { if ( this.btnsComment.length ) {
var _comments = PE.getController('Common.Controllers.Comments').getView(); var _comments = PE.getController('Common.Controllers.Comments').getView();
Array.prototype.push.apply(me.toolbar.lockControls, this.btnsComment); Array.prototype.push.apply(me.toolbar.lockControls, this.btnsComment);
Array.prototype.push.apply(me.toolbar.slideOnlyControls, this.btnsComment);
this.btnsComment.forEach(function (btn) { this.btnsComment.forEach(function (btn) {
btn.updateHint( _comments.textAddComment ); btn.updateHint( _comments.textAddComment );
btn.on('click', function (btn, e) { btn.on('click', function (btn, e) {