Merge pull request #1027 from ONLYOFFICE/fix/bug-51484

[SSE] For Bug 51484
This commit is contained in:
Julia Radzhabova 2021-07-29 15:43:25 +03:00 committed by GitHub
commit db132fbbff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 14 deletions

View file

@ -680,6 +680,7 @@ define([
cellinfo = this.api.asc_getCellInfo(); cellinfo = this.api.asc_getCellInfo();
if (controller) { if (controller) {
var comments = cellinfo.asc_getComments(); var comments = cellinfo.asc_getComments();
if (comments) {
if (comments.length) { if (comments.length) {
controller.onEditComments(comments); controller.onEditComments(comments);
} else if (this.permissions.canCoAuthoring) { } else if (this.permissions.canCoAuthoring) {
@ -687,6 +688,7 @@ define([
} }
} }
} }
}
}, },
onAddNamedRange: function(item) { onAddNamedRange: function(item) {
@ -1981,9 +1983,9 @@ define([
documentHolder.pmiFreezePanes.setCaption(this.api.asc_getSheetViewSettings().asc_getIsFreezePane() ? documentHolder.textUnFreezePanes : documentHolder.textFreezePanes); documentHolder.pmiFreezePanes.setCaption(this.api.asc_getSheetViewSettings().asc_getIsFreezePane() ? documentHolder.textUnFreezePanes : documentHolder.textFreezePanes);
/** coauthoring begin **/ /** coauthoring begin **/
var count = cellinfo.asc_getComments().length; var celcomments = cellinfo.asc_getComments(); // celcomments===null - has comment, but no permissions to view it
documentHolder.ssMenu.items[19].setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && count < 1); documentHolder.ssMenu.items[19].setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && celcomments && (celcomments.length < 1));
documentHolder.pmiAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && count < 1); documentHolder.pmiAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && celcomments && (celcomments.length < 1));
/** coauthoring end **/ /** coauthoring end **/
documentHolder.pmiCellMenuSeparator.setVisible(iscellmenu && !iscelledit || isrowmenu || iscolmenu || isallmenu); documentHolder.pmiCellMenuSeparator.setVisible(iscellmenu && !iscelledit || isrowmenu || iscolmenu || isallmenu);
documentHolder.pmiEntireHide.isrowmenu = isrowmenu; documentHolder.pmiEntireHide.isrowmenu = isrowmenu;
@ -2091,7 +2093,7 @@ define([
var signProps = (signGuid) ? this.api.asc_getSignatureSetup(signGuid) : null, var signProps = (signGuid) ? this.api.asc_getSignatureSetup(signGuid) : null,
isInSign = !!signProps && this._canProtect, isInSign = !!signProps && this._canProtect,
canComment = iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && !this._isDisabled && cellinfo.asc_getComments().length < 1; canComment = iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments && !this._isDisabled && cellinfo.asc_getComments() && cellinfo.asc_getComments().length < 1;
documentHolder.menuViewUndo.setVisible(this.permissions.canCoAuthoring && this.permissions.canComments && !this._isDisabled); documentHolder.menuViewUndo.setVisible(this.permissions.canCoAuthoring && this.permissions.canComments && !this._isDisabled);
documentHolder.menuViewUndo.setDisabled(!this.api.asc_getCanUndo() && !this._isDisabled); documentHolder.menuViewUndo.setDisabled(!this.api.asc_getCanUndo() && !this._isDisabled);

View file

@ -2843,7 +2843,8 @@ define([
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, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()) || // info.asc_getComments()===null - has comment, but no permissions to view it
toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.toolbar.mode.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), this.toolbar.mode.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells),
{ array: this.btnsComment }); { array: this.btnsComment });
@ -2852,7 +2853,7 @@ define([
onApiSelectionChangedRestricted: function(info) { onApiSelectionChangedRestricted: function(info) {
var selectionType = info.asc_getSelectionType(); var selectionType = info.asc_getSelectionType();
this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()) || this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells),
{ array: this.btnsComment }); { array: this.btnsComment });
}, },

View file

@ -187,7 +187,7 @@ class ContextMenu extends ContextMenuController {
let iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu; let iscellmenu, isrowmenu, iscolmenu, isallmenu, ischartmenu, isimagemenu, istextshapemenu, isshapemenu, istextchartmenu;
const seltype = cellinfo.asc_getSelectionType(); const seltype = cellinfo.asc_getSelectionType();
const isComments = cellinfo.asc_getComments().length > 0; //prohibit adding multiple comments in one cell; const hasComments = cellinfo.asc_getComments(); //prohibit adding multiple comments in one cell;
switch (seltype) { switch (seltype) {
case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break; case Asc.c_oAscSelectionType.RangeCells: iscellmenu = true; break;
@ -212,14 +212,14 @@ class ContextMenu extends ContextMenuController {
event: 'openlink' event: 'openlink'
}); });
} }
if (canViewComments && isComments) { if (canViewComments && hasComments && hasComments.length>0) {
itemsText.push({ itemsText.push({
caption: _t.menuViewComment, caption: _t.menuViewComment,
event: 'viewcomment' event: 'viewcomment'
}); });
} }
if (iscellmenu && !api.isCellEdited && canCoAuthoring && canComments && !isComments) { if (iscellmenu && !api.isCellEdited && canCoAuthoring && canComments && hasComments && hasComments.length<1) {
itemsText.push({ itemsText.push({
caption: _t.menuAddComment, caption: _t.menuAddComment,
event: 'addcomment' event: 'addcomment'

View file

@ -22,7 +22,7 @@ class AddOtherController extends Component {
const cellinfo = Common.EditorApi.get().asc_getCellInfo(); const cellinfo = Common.EditorApi.get().asc_getCellInfo();
const iscelllocked = cellinfo.asc_getLocked(); const iscelllocked = cellinfo.asc_getLocked();
const seltype = cellinfo.asc_getSelectionType(); const seltype = cellinfo.asc_getSelectionType();
const isComments = cellinfo.asc_getComments().length > 0; const isComments = !cellinfo.asc_getComments() || cellinfo.asc_getComments().length > 0;
return (!(seltype === Asc.c_oAscSelectionType.RangeCells && !iscelllocked) || isComments); return (!(seltype === Asc.c_oAscSelectionType.RangeCells && !iscelllocked) || isComments);
} }