Merge pull request #953 from ONLYOFFICE/fix/fix-bugs-on-mobiles
[mobile] Fix bug 47933, fix context menu in comment mode
This commit is contained in:
commit
18dfe1500e
|
@ -11,7 +11,9 @@ import EditorUIController from '../lib/patch';
|
||||||
|
|
||||||
@inject ( stores => ({
|
@inject ( stores => ({
|
||||||
isEdit: stores.storeAppOptions.isEdit,
|
isEdit: stores.storeAppOptions.isEdit,
|
||||||
|
canComments: stores.storeAppOptions.canComments,
|
||||||
canViewComments: stores.storeAppOptions.canViewComments,
|
canViewComments: stores.storeAppOptions.canViewComments,
|
||||||
|
canCoAuthoring: stores.storeAppOptions.canCoAuthoring,
|
||||||
canReview: stores.storeAppOptions.canReview,
|
canReview: stores.storeAppOptions.canReview,
|
||||||
users: stores.users,
|
users: stores.users,
|
||||||
isDisconnected: stores.users.isDisconnected
|
isDisconnected: stores.users.isDisconnected
|
||||||
|
@ -216,12 +218,35 @@ class ContextMenu extends ContextMenuController {
|
||||||
} else {
|
} else {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
const _t = t("ContextMenu", {returnObjects: true});
|
const _t = t("ContextMenu", {returnObjects: true});
|
||||||
const { canViewComments } = this.props;
|
const { canViewComments, canCoAuthoring, canComments } = this.props;
|
||||||
|
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const stack = api.getSelectedElements();
|
const stack = api.getSelectedElements();
|
||||||
const canCopy = api.can_CopyCut();
|
const canCopy = api.can_CopyCut();
|
||||||
|
|
||||||
|
let isText = false,
|
||||||
|
isObject = false,
|
||||||
|
isLink = false,
|
||||||
|
locked = false;
|
||||||
|
|
||||||
|
stack.forEach(item => {
|
||||||
|
const objectType = item.get_ObjectType(),
|
||||||
|
objectValue = item.get_ObjectValue();
|
||||||
|
if ( objectType == Asc.c_oAscTypeSelectElement.Header ) {
|
||||||
|
locked = objectValue.get_Locked();
|
||||||
|
} else
|
||||||
|
if ( objectType == Asc.c_oAscTypeSelectElement.Paragraph ) {
|
||||||
|
locked = objectValue.get_Locked();
|
||||||
|
isText = true;
|
||||||
|
} else
|
||||||
|
if ( objectType == Asc.c_oAscTypeSelectElement.Image || objectType == Asc.c_oAscTypeSelectElement.Table) {
|
||||||
|
locked = objectValue.get_Locked();
|
||||||
|
isObject = true;
|
||||||
|
} else if ( objectType == Asc.c_oAscTypeSelectElement.Hyperlink ) {
|
||||||
|
isLink = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let itemsIcon = [],
|
let itemsIcon = [],
|
||||||
itemsText = [];
|
itemsText = [];
|
||||||
|
|
||||||
|
@ -239,13 +264,12 @@ class ContextMenu extends ContextMenuController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let isLink = false;
|
if (api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked && !(!isText && isObject)) {
|
||||||
stack.forEach(item => {
|
itemsText.push({
|
||||||
const objectType = item.get_ObjectType();
|
caption: _t.menuAddComment,
|
||||||
if ( objectType === Asc.c_oAscTypeSelectElement.Hyperlink ) {
|
event: 'addcomment'
|
||||||
isLink = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if ( isLink ) {
|
if ( isLink ) {
|
||||||
itemsText.push({
|
itemsText.push({
|
||||||
|
|
|
@ -11,7 +11,9 @@ import EditorUIController from '../lib/patch';
|
||||||
|
|
||||||
@inject ( stores => ({
|
@inject ( stores => ({
|
||||||
isEdit: stores.storeAppOptions.isEdit,
|
isEdit: stores.storeAppOptions.isEdit,
|
||||||
|
canComments: stores.storeAppOptions.canComments,
|
||||||
canViewComments: stores.storeAppOptions.canViewComments,
|
canViewComments: stores.storeAppOptions.canViewComments,
|
||||||
|
canCoAuthoring: stores.storeAppOptions.canCoAuthoring,
|
||||||
users: stores.users,
|
users: stores.users,
|
||||||
isDisconnected: stores.users.isDisconnected
|
isDisconnected: stores.users.isDisconnected
|
||||||
}))
|
}))
|
||||||
|
@ -198,7 +200,7 @@ class ContextMenu extends ContextMenuController {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
const _t = t("ContextMenu", { returnObjects: true });
|
const _t = t("ContextMenu", { returnObjects: true });
|
||||||
|
|
||||||
const { canViewComments, isDisconnected } = this.props;
|
const { canViewComments, canCoAuthoring, canComments } = this.props;
|
||||||
|
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const stack = api.getSelectedElements();
|
const stack = api.getSelectedElements();
|
||||||
|
@ -214,11 +216,13 @@ class ContextMenu extends ContextMenuController {
|
||||||
isShape = false,
|
isShape = false,
|
||||||
isLink = false,
|
isLink = false,
|
||||||
isSlide = false,
|
isSlide = false,
|
||||||
isObject = false;
|
isObject,
|
||||||
|
locked = false;
|
||||||
|
|
||||||
stack.forEach(item => {
|
stack.forEach(item => {
|
||||||
const objectType = item.get_ObjectType(),
|
const objectType = item.get_ObjectType(),
|
||||||
objectValue = item.get_ObjectValue();
|
objectValue = item.get_ObjectValue();
|
||||||
|
locked = typeof objectValue.get_Locked === 'function' ? objectValue.get_Locked() : false;
|
||||||
|
|
||||||
if (objectType == Asc.c_oAscTypeSelectElement.Paragraph) {
|
if (objectType == Asc.c_oAscTypeSelectElement.Paragraph) {
|
||||||
isText = true;
|
isText = true;
|
||||||
|
@ -252,6 +256,13 @@ class ContextMenu extends ContextMenuController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isChart && api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked) {
|
||||||
|
itemsText.push({
|
||||||
|
caption: _t.menuAddComment,
|
||||||
|
event: 'addcomment'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (isLink) {
|
if (isLink) {
|
||||||
itemsText.push({
|
itemsText.push({
|
||||||
caption: _t.menuOpenLink,
|
caption: _t.menuOpenLink,
|
||||||
|
|
|
@ -11,7 +11,9 @@ import EditorUIController from '../lib/patch';
|
||||||
|
|
||||||
@inject ( stores => ({
|
@inject ( stores => ({
|
||||||
isEdit: stores.storeAppOptions.isEdit,
|
isEdit: stores.storeAppOptions.isEdit,
|
||||||
|
canComments: stores.storeAppOptions.canComments,
|
||||||
canViewComments: stores.storeAppOptions.canViewComments,
|
canViewComments: stores.storeAppOptions.canViewComments,
|
||||||
|
canCoAuthoring: stores.storeAppOptions.canCoAuthoring,
|
||||||
users: stores.users,
|
users: stores.users,
|
||||||
isDisconnected: stores.users.isDisconnected,
|
isDisconnected: stores.users.isDisconnected,
|
||||||
storeSheets: stores.sheets
|
storeSheets: stores.sheets
|
||||||
|
@ -175,7 +177,7 @@ class ContextMenu extends ContextMenuController {
|
||||||
if (isEdit && EditorUIController.ContextMenu) {
|
if (isEdit && EditorUIController.ContextMenu) {
|
||||||
return EditorUIController.ContextMenu.mapMenuItems(this);
|
return EditorUIController.ContextMenu.mapMenuItems(this);
|
||||||
} else {
|
} else {
|
||||||
const {canViewComments } = this.props;
|
const {canViewComments, canCoAuthoring, canComments } = this.props;
|
||||||
|
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const cellinfo = api.asc_getCellInfo();
|
const cellinfo = api.asc_getCellInfo();
|
||||||
|
@ -199,12 +201,11 @@ class ContextMenu extends ContextMenuController {
|
||||||
case Asc.c_oAscSelectionType.RangeShapeText: istextshapemenu = true; break;
|
case Asc.c_oAscSelectionType.RangeShapeText: istextshapemenu = true; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iscellmenu || istextchartmenu || istextshapemenu) {
|
|
||||||
itemsIcon.push({
|
itemsIcon.push({
|
||||||
event: 'copy',
|
event: 'copy',
|
||||||
icon: 'icon-copy'
|
icon: 'icon-copy'
|
||||||
});
|
});
|
||||||
}
|
|
||||||
if (iscellmenu && cellinfo.asc_getHyperlink()) {
|
if (iscellmenu && cellinfo.asc_getHyperlink()) {
|
||||||
itemsText.push({
|
itemsText.push({
|
||||||
caption: _t.menuOpenLink,
|
caption: _t.menuOpenLink,
|
||||||
|
@ -218,6 +219,13 @@ class ContextMenu extends ContextMenuController {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iscellmenu && !api.isCellEdited && canCoAuthoring && canComments && !isComments) {
|
||||||
|
itemsText.push({
|
||||||
|
caption: _t.menuAddComment,
|
||||||
|
event: 'addcomment'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return itemsIcon.concat(itemsText);
|
return itemsIcon.concat(itemsText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue