Merge with remote

This commit is contained in:
Maxim Kadushkin 2017-06-28 14:53:50 +03:00
commit 32a688e910
6 changed files with 42 additions and 23 deletions

View file

@ -584,9 +584,8 @@ define([
} }
}, },
onAppAddComment: function () { onAppAddComment: function () {
if ( this.api.can_AddQuotedComment() !== false ) { if ( this.can_AddQuotedComment && this.api.can_AddQuotedComment() === false ) return;
this.addDummyComment(); this.addDummyComment();
}
}, },
// SDK // SDK

View file

@ -728,6 +728,12 @@ 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;
if (this.btnsComment && this.btnsComment.length>0 && need_disable != this.btnsComment[0].isDisabled())
_.each (this.btnsComment, function(item){
item.setDisabled(need_disable);
}, this);
this._state.in_equation = in_equation; this._state.in_equation = in_equation;
}, },
@ -2787,7 +2793,7 @@ define([
var me = this; var me = this;
if ( config.canCoAuthoring && config.canComments ) { if ( config.canCoAuthoring && config.canComments ) {
var _btnsComment = []; this.btnsComment = [];
var slots = me.toolbar.$el.find('.slot-comment'); var slots = me.toolbar.$el.find('.slot-comment');
slots.each(function(index, el) { slots.each(function(index, el) {
var _cls = 'btn-toolbar'; var _cls = 'btn-toolbar';
@ -2799,13 +2805,13 @@ define([
caption: me.toolbar.capBtnComment caption: me.toolbar.capBtnComment
}).render( slots.eq(index) ); }).render( slots.eq(index) );
_btnsComment.push(button); me.btnsComment.push(button);
}); });
if ( _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.toolbarControls, _btnsComment); Array.prototype.push.apply(me.toolbar.paragraphControls, this.btnsComment);
_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) {
Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); Common.NotificationCenter.trigger('app:comment:add', 'toolbar');

View file

@ -584,6 +584,8 @@ define([
]}); ]});
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides,
{ array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape) }); { array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape) });
if (this.btnsComment)
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
} }
}, },
@ -648,9 +650,11 @@ 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)}); this.toolbar.lockToolbar(PE.enumLock.shapeLock, shape_locked, {array: me.toolbar.shapeControls.concat(me.toolbar.paragraphControls).concat(me.btnsComment)});
} }
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 ]});
@ -2059,8 +2063,9 @@ define([
onAppReady: function (config) { onAppReady: function (config) {
var me = this; var me = this;
this.btnsComment = [];
if ( config.canCoAuthoring && config.canComments ) { if ( config.canCoAuthoring && config.canComments ) {
var _btnsComment = []; var _set = PE.enumLock;
var slots = me.toolbar.$el.find('.slot-comment'); var slots = me.toolbar.$el.find('.slot-comment');
slots.each(function(index, el) { slots.each(function(index, el) {
var _cls = 'btn-toolbar'; var _cls = 'btn-toolbar';
@ -2069,21 +2074,24 @@ 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],
caption: me.toolbar.capBtnComment caption: me.toolbar.capBtnComment
}).render( slots.eq(index) ); }).render( slots.eq(index) );
_btnsComment.push(button); me.btnsComment.push(button);
}); });
if ( _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.toolbarControls, _btnsComment); Array.prototype.push.apply(me.toolbar.lockControls, this.btnsComment);
_btnsComment.forEach(function (btn) { Array.prototype.push.apply(me.toolbar.slideOnlyControls, this.btnsComment);
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) {
Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); Common.NotificationCenter.trigger('app:comment:add', 'toolbar');
}); });
}, this); }, this);
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
} }
} }

View file

@ -79,7 +79,8 @@ define([
disableOnStart: 'on-start', disableOnStart: 'on-start',
cantPrint: 'cant-print', cantPrint: 'cant-print',
noTextSelected: 'no-text', noTextSelected: 'no-text',
inEquation: 'in-equation' inEquation: 'in-equation',
commentLock: 'can-comment'
}; };
var buttonsArray = function (opts) { var buttonsArray = function (opts) {

View file

@ -1600,7 +1600,7 @@ define([
toolbar.mnuitemClearFilter, toolbar.mnuitemClearFilter,
toolbar.btnNamedRange.menu.items[0], toolbar.btnNamedRange.menu.items[0],
toolbar.btnNamedRange.menu.items[1] toolbar.btnNamedRange.menu.items[1]
], ].concat(this.btnsComment),
merge: true, merge: true,
clear: [SSE.enumLock.editFormula, SSE.enumLock.editText] clear: [SSE.enumLock.editFormula, SSE.enumLock.editText]
}); });
@ -2087,6 +2087,8 @@ define([
toolbar.btnAddCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down); toolbar.btnAddCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down);
toolbar.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down); toolbar.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down);
} }
toolbar.lockToolbar(SSE.enumLock.commentLock, info.asc_getComments().length>0, { array: this.btnsComment });
}, },
onApiSelectionChanged_DiagramEditor: function(info) { onApiSelectionChanged_DiagramEditor: function(info) {
@ -2674,7 +2676,7 @@ define([
toolbar.mnuitemSortZA, toolbar.mnuitemSortZA,
toolbar.mnuitemAutoFilter, toolbar.mnuitemAutoFilter,
toolbar.mnuitemClearFilter toolbar.mnuitemClearFilter
], ].concat(this.btnsComment),
merge: true, merge: true,
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth] clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
}); });
@ -2884,8 +2886,9 @@ define([
onAppReady: function (config) { onAppReady: function (config) {
var me = this; var me = this;
this.btnsComment = [];
if ( config.canCoAuthoring && config.canComments ) { if ( config.canCoAuthoring && config.canComments ) {
var _btnsComment = []; var _set = SSE.enumLock;
var slots = me.toolbar.$el.find('.slot-comment'); var slots = me.toolbar.$el.find('.slot-comment');
slots.each(function(index, el) { slots.each(function(index, el) {
var _cls = 'btn-toolbar'; var _cls = 'btn-toolbar';
@ -2894,16 +2897,17 @@ 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.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.commentLock],
caption: me.toolbar.capBtnComment caption: me.toolbar.capBtnComment
}).render( slots.eq(index) ); }).render( slots.eq(index) );
_btnsComment.push(button); me.btnsComment.push(button);
}); });
if ( _btnsComment.length ) { if ( this.btnsComment.length ) {
var _comments = SSE.getController('Common.Controllers.Comments').getView(); var _comments = SSE.getController('Common.Controllers.Comments').getView();
Array.prototype.push.apply(me.toolbar.lockControls, _btnsComment); Array.prototype.push.apply(me.toolbar.lockControls, this.btnsComment);
_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) {
Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); Common.NotificationCenter.trigger('app:comment:add', 'toolbar');

View file

@ -76,7 +76,8 @@ define([
menuFileOpen: 'menu-file-open', menuFileOpen: 'menu-file-open',
cantPrint: 'cant-print', cantPrint: 'cant-print',
multiselect: 'is-multiselect', multiselect: 'is-multiselect',
cantHyperlink: 'cant-hyperlink' cantHyperlink: 'cant-hyperlink',
commentLock: 'can-comment'
}; };
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({ SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({