From 743cd8a42ac5f99d0b425fe511fc60d435e7fd77 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 19 Jan 2022 16:08:03 +0300 Subject: [PATCH 1/2] [DE Mobile] disable editing for fill forms and commenting when no license (Bug 54910) --- .../mobile/src/controller/Main.jsx | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 3a66ddafd..c9ba77dfe 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -558,32 +558,31 @@ class MainController extends Component { storeDocumentSettings.changeDocSize(w, h); }); - const storeAppOptions = this.props.storeAppOptions; + this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => { + const storeAppOptions = this.props.storeAppOptions; + if (!storeAppOptions.isEdit && !(storeAppOptions.isRestrictedEdit && storeAppOptions.canFillForms) || this.props.users.isDisconnected) return; - if (storeAppOptions.isEdit || storeAppOptions.isRestrictedEdit && storeAppOptions.canFillForms) { - this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => { - switch (obj.type) { - case Asc.c_oAscContentControlSpecificType.DateTime: - this.onShowDateActions(obj, x, y); - break; - case Asc.c_oAscContentControlSpecificType.Picture: - if (obj.pr && obj.pr.get_Lock) { - let lock = obj.pr.get_Lock(); - if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked) - return; - } - this.api.asc_addImage(obj); - setTimeout(() => { - this.api.asc_UncheckContentControlButtons(); - }, 500); - break; - case Asc.c_oAscContentControlSpecificType.DropDownList: - case Asc.c_oAscContentControlSpecificType.ComboBox: - this.onShowListActions(obj, x, y); - break; - } - }); - } + switch (obj.type) { + case Asc.c_oAscContentControlSpecificType.DateTime: + this.onShowDateActions(obj, x, y); + break; + case Asc.c_oAscContentControlSpecificType.Picture: + if (obj.pr && obj.pr.get_Lock) { + let lock = obj.pr.get_Lock(); + if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked) + return; + } + this.api.asc_addImage(obj); + setTimeout(() => { + this.api.asc_UncheckContentControlButtons(); + }, 500); + break; + case Asc.c_oAscContentControlSpecificType.DropDownList: + case Asc.c_oAscContentControlSpecificType.ComboBox: + this.onShowListActions(obj, x, y); + break; + } + }); const storeTextSettings = this.props.storeTextSettings; storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts')); From 48b682c54c12c472c85fb8beacf2290d93244fce Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Wed, 19 Jan 2022 18:43:11 +0400 Subject: [PATCH 2/2] [PE SSE mobile] Correct context menu --- .../mobile/src/controller/ContextMenu.jsx | 28 ++++++++++--------- .../mobile/src/controller/ContextMenu.jsx | 28 ++++++++++--------- .../mobile/src/controller/Main.jsx | 5 ++++ 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx index 2b71baaac..73615138b 100644 --- a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx @@ -196,7 +196,7 @@ class ContextMenu extends ContextMenuController { initMenuItems() { if ( !Common.EditorApi ) return []; - const { isEdit } = this.props; + const { isEdit, isDisconnected } = this.props; if (isEdit && EditorUIController.ContextMenu) { return EditorUIController.ContextMenu.mapMenuItems(this); @@ -253,18 +253,20 @@ class ContextMenu extends ContextMenuController { icon: 'icon-copy' }); } - if (canViewComments && this.isComments && !isEdit) { - itemsText.push({ - caption: _t.menuViewComment, - event: 'viewcomment' - }); - } - - if (!isChart && api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked) { - itemsText.push({ - caption: _t.menuAddComment, - event: 'addcomment' - }); + if(!isDisconnected) { + if (canViewComments && this.isComments && !isEdit) { + itemsText.push({ + caption: _t.menuViewComment, + event: 'viewcomment' + }); + } + + if (!isChart && api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked) { + itemsText.push({ + caption: _t.menuAddComment, + event: 'addcomment' + }); + } } if (isLink) { diff --git a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx index 073cde124..c347f4353 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx @@ -209,7 +209,7 @@ class ContextMenu extends ContextMenuController { const { t } = this.props; const _t = t("ContextMenu", { returnObjects: true }); - const { isEdit } = this.props; + const { isEdit, isDisconnected } = this.props; if (isEdit && EditorUIController.ContextMenu) { return EditorUIController.ContextMenu.mapMenuItems(this); @@ -249,18 +249,20 @@ class ContextMenu extends ContextMenuController { event: 'openlink' }); } - if (canViewComments && hasComments && hasComments.length>0) { - itemsText.push({ - caption: _t.menuViewComment, - event: 'viewcomment' - }); - } - - if (iscellmenu && !api.isCellEdited && canCoAuthoring && canComments && hasComments && hasComments.length<1) { - itemsText.push({ - caption: _t.menuAddComment, - event: 'addcomment' - }); + if(!isDisconnected) { + if (canViewComments && hasComments && hasComments.length>0) { + itemsText.push({ + caption: _t.menuViewComment, + event: 'viewcomment' + }); + } + + if (iscellmenu && !api.isCellEdited && canCoAuthoring && canComments && hasComments && hasComments.length<1) { + itemsText.push({ + caption: _t.menuAddComment, + event: 'addcomment' + }); + } } return itemsIcon.concat(itemsText); diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 35d627034..44be0b004 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -426,11 +426,16 @@ class MainController extends Component { this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this)); this.api.asc_registerCallback('asc_onRenameCellTextEnd', this.onRenameText.bind(this)); + this.api.asc_registerCallback('asc_onEntriesListMenu', this.onEntriesListMenu.bind(this, false)); this.api.asc_registerCallback('asc_onValidationListMenu', this.onEntriesListMenu.bind(this, true)); } onEntriesListMenu(validation, textArr, addArr) { + const storeAppOptions = this.props.storeAppOptions; + + if (!storeAppOptions.isEdit && !storeAppOptions.isRestrictedEdit || this.props.users.isDisconnected) return; + const { t } = this.props; const boxSdk = $$('#editor_sdk');