Merge branch 'feature/new-toolbar' into feature/new-toolbar-pivot-table

This commit is contained in:
Julia Radzhabova 2017-06-30 14:53:19 +03:00
commit 917ff1da54
5 changed files with 28 additions and 14 deletions

View file

@ -583,8 +583,8 @@ define([
}
}
},
onAppAddComment: function () {
if ( this.can_AddQuotedComment && this.api.can_AddQuotedComment() === false ) return;
onAppAddComment: function (sender, to_doc) {
if ( !!this.api.can_AddQuotedComment && this.api.can_AddQuotedComment() === false || to_doc) return;
this.addDummyComment();
},

View file

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

View file

@ -650,11 +650,9 @@ define([
if (shape_locked!==undefined && 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.activated) this._state.no_object = no_object;
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({
cls: _cls,
iconCls: 'btn-menu-comments',
lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.shapeLock, _set.commentLock],
lock: [_set.lostConnect, _set.noSlides],
caption: me.toolbar.capBtnComment
}).render( slots.eq(index) );
@ -2084,7 +2082,6 @@ define([
if ( this.btnsComment.length ) {
var _comments = PE.getController('Common.Controllers.Comments').getView();
Array.prototype.push.apply(me.toolbar.lockControls, this.btnsComment);
Array.prototype.push.apply(me.toolbar.slideOnlyControls, this.btnsComment);
this.btnsComment.forEach(function (btn) {
btn.updateHint( _comments.textAddComment );
btn.on('click', function (btn, e) {

View file

@ -87,6 +87,7 @@ define([
'search:replaceall': _.bind(this.onQueryReplaceAll, this)
}
});
Common.NotificationCenter.on('app:comment:add', _.bind(this.onAppAddComment, this));
},
onLaunch: function() {
@ -550,6 +551,22 @@ define([
}
},
onAppAddComment: function(sender, to_doc) {
if ( to_doc ) {
var me = this;
(new Promise(function(resolve, reject) {
resolve();
})).then(function () {
Common.UI.Menu.Manager.hideAll();
me.leftMenu.showMenu('comments');
var ctrl = SSE.getController('Common.Controllers.Comments');
ctrl.getView().showEditContainer(true);
ctrl.onAfterShow();
});
}
},
commentsShowHide: function(state) {
if (this.api) {
var value = Common.localStorage.getItem("sse-settings-livecomment"),

View file

@ -1600,7 +1600,7 @@ define([
toolbar.mnuitemClearFilter,
toolbar.btnNamedRange.menu.items[0],
toolbar.btnNamedRange.menu.items[1]
].concat(this.btnsComment),
],
merge: true,
clear: [SSE.enumLock.editFormula, SSE.enumLock.editText]
});
@ -2091,7 +2091,8 @@ define([
toolbar.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down);
}
toolbar.lockToolbar(SSE.enumLock.commentLock, info.asc_getComments().length>0, { array: this.btnsComment });
toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()),
{ array: this.btnsComment });
},
onApiSelectionChanged_DiagramEditor: function(info) {
@ -2679,7 +2680,7 @@ define([
toolbar.mnuitemSortZA,
toolbar.mnuitemAutoFilter,
toolbar.mnuitemClearFilter
].concat(this.btnsComment),
],
merge: true,
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
});
@ -2900,7 +2901,7 @@ define([
var button = new Common.UI.Button({
cls: _cls,
iconCls: 'btn-menu-comments',
lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.commentLock],
lock: [_set.lostConnect, _set.commentLock],
caption: me.toolbar.capBtnComment
}).render( slots.eq(index) );
@ -2913,7 +2914,7 @@ define([
this.btnsComment.forEach(function (btn) {
btn.updateHint( _comments.textAddComment );
btn.on('click', function (btn, e) {
Common.NotificationCenter.trigger('app:comment:add', 'toolbar');
Common.NotificationCenter.trigger('app:comment:add', 'toolbar', me.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType() != Asc.c_oAscSelectionType.RangeCells);
});
}, this);
}