diff --git a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx index a55b2281c..a9ac7b8a8 100644 --- a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx @@ -19,7 +19,8 @@ import EditorUIController from '../lib/patch'; users: stores.users, isDisconnected: stores.users.isDisconnected, displayMode: stores.storeReview.displayMode, - dataDoc: stores.storeDocumentInfo.dataDoc + dataDoc: stores.storeDocumentInfo.dataDoc, + objects: stores.storeFocusObjects.settings })) class ContextMenu extends ContextMenuController { constructor(props) { @@ -32,6 +33,7 @@ class ContextMenu extends ContextMenuController { this.getUserName = this.getUserName.bind(this); this.isUserVisible = this.isUserVisible.bind(this); this.ShowModal = this.ShowModal.bind(this); + this.checkShapeSelection = this.checkShapeSelection.bind(this); } static closeContextMenu() { @@ -55,6 +57,7 @@ class ContextMenu extends ContextMenuController { api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment); api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment); api.asc_unregisterCallback('asc_onShowRevisionsChange', this.onApiShowChange); + api.asc_unregisterCallback('asc_onShowPopMenu', this.checkShapeSelection); Common.Notifications.off('showSplitModal', this.ShowModal); } @@ -132,6 +135,15 @@ class ContextMenu extends ContextMenuController { } } + checkShapeSelection() { + const objects = this.props.objects; + const contextMenuElem = document.querySelector('#idx-context-menu-popover'); + + if(objects.indexOf('shape') > -1) { + contextMenuElem.style.top = `${+(contextMenuElem.style.top.replace(/px$/, '')) - 40}px`; + } + } + onTableContentsUpdate(type, currentTOC) { const api = Common.EditorApi.get(); let props = api.asc_GetTableOfContentsPr(currentTOC); @@ -144,6 +156,7 @@ class ContextMenu extends ContextMenuController { showCopyCutPasteModal() { const { t } = this.props; const _t = t("ContextMenu", { returnObjects: true }); + f7.dialog.create({ title: _t.textCopyCutPasteActions, text: _t.errorCopyCutPaste, @@ -168,6 +181,7 @@ class ContextMenu extends ContextMenuController { const { t } = this.props; const _t = t("ContextMenu", { returnObjects: true }); let picker; + const dialog = f7.dialog.create({ title: _t.menuSplit, text: '', @@ -253,11 +267,13 @@ class ContextMenu extends ContextMenuController { api.asc_registerCallback('asc_onShowComment', this.onApiShowComment); api.asc_registerCallback('asc_onHideComment', this.onApiHideComment); api.asc_registerCallback('asc_onShowRevisionsChange', this.onApiShowChange); + api.asc_registerCallback('asc_onShowPopMenu', this.checkShapeSelection); Common.Notifications.on('showSplitModal', this.ShowModal); } initMenuItems() { if ( !Common.EditorApi ) return []; + const { isEdit, canFillForms, isDisconnected } = this.props; if (isEdit && EditorUIController.ContextMenu) { diff --git a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx index 38afb5611..b49140d5b 100644 --- a/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/presentationeditor/mobile/src/controller/ContextMenu.jsx @@ -15,7 +15,8 @@ import EditorUIController from '../lib/patch'; canViewComments: stores.storeAppOptions.canViewComments, canCoAuthoring: stores.storeAppOptions.canCoAuthoring, users: stores.users, - isDisconnected: stores.users.isDisconnected + isDisconnected: stores.users.isDisconnected, + objects: stores.storeFocusObjects.settings })) class ContextMenu extends ContextMenuController { constructor(props) { @@ -26,6 +27,7 @@ class ContextMenu extends ContextMenuController { this.onApiHideComment = this.onApiHideComment.bind(this); this.getUserName = this.getUserName.bind(this); this.isUserVisible = this.isUserVisible.bind(this); + this.checkShapeSelection = this.checkShapeSelection.bind(this); } static closeContextMenu() { @@ -49,6 +51,7 @@ class ContextMenu extends ContextMenuController { if ( api ) { api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment); api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment); + api.asc_unregisterCallback('asc_onShowPopMenu', this.checkShapeSelection); } } @@ -104,6 +107,15 @@ class ContextMenu extends ContextMenuController { } } + checkShapeSelection() { + const objects = this.props.objects; + const contextMenuElem = document.querySelector('#idx-context-menu-popover'); + + if(objects.indexOf('shape') > -1) { + contextMenuElem.style.top = `${+(contextMenuElem.style.top.replace(/px$/, '')) - 40}px`; + } + } + showCopyCutPasteModal() { const { t } = this.props; const _t = t("ContextMenu", { returnObjects: true }); @@ -220,6 +232,7 @@ class ContextMenu extends ContextMenuController { const api = Common.EditorApi.get(); api.asc_registerCallback('asc_onShowComment', this.onApiShowComment); api.asc_registerCallback('asc_onHideComment', this.onApiHideComment); + api.asc_registerCallback('asc_onShowPopMenu', this.checkShapeSelection); } initMenuItems() { diff --git a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx index 88dfd1d7c..ad47c5568 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx @@ -19,7 +19,9 @@ import EditorUIController from '../lib/patch'; isDisconnected: stores.users.isDisconnected, storeSheets: stores.sheets, wsProps: stores.storeWorksheets.wsProps, - wsLock: stores.storeWorksheets.wsLock + wsLock: stores.storeWorksheets.wsLock, + objects: stores.storeFocusObjects.objects, + focusOn: stores.storeFocusObjects.focusOn })) class ContextMenu extends ContextMenuController { constructor(props) { @@ -34,6 +36,7 @@ class ContextMenu extends ContextMenuController { this.isUserVisible = this.isUserVisible.bind(this); this.onApiMouseMove = this.onApiMouseMove.bind(this); this.onApiHyperlinkClick = this.onApiHyperlinkClick.bind(this); + this.checkShapeSelection = this.checkShapeSelection.bind(this); } static closeContextMenu() { @@ -59,6 +62,7 @@ class ContextMenu extends ContextMenuController { api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment); api.asc_unregisterCallback('asc_onMouseMove', this.onApiMouseMove); api.asc_unregisterCallback('asc_onHyperlinkClick', this.onApiHyperlinkClick); + api.asc_unregisterCallback('asc_onShowPopMenu', this.checkShapeSelection); } } @@ -230,6 +234,7 @@ class ContextMenu extends ContextMenuController { api.asc_registerCallback('asc_onHideComment', this.onApiHideComment); api.asc_registerCallback('asc_onMouseMove', this.onApiMouseMove); api.asc_registerCallback('asc_onHyperlinkClick', this.onApiHyperlinkClick); + api.asc_registerCallback('asc_onShowPopMenu', this.checkShapeSelection); } initMenuItems() { @@ -302,6 +307,16 @@ class ContextMenu extends ContextMenuController { } } + checkShapeSelection() { + const objects = this.props.objects; + const focusOn = this.props.focusOn; + const contextMenuElem = document.querySelector('#idx-context-menu-popover'); + + if(objects.indexOf('shape') > -1 && focusOn === 'obj') { + contextMenuElem.style.top = `${+(contextMenuElem.style.top.replace(/px$/, '')) - 40}px`; + } + } + onApiMouseMove(dataarray) { const tipHeight = 20; let index_locked, diff --git a/apps/spreadsheeteditor/mobile/src/store/focusObjects.js b/apps/spreadsheeteditor/mobile/src/store/focusObjects.js index dd1b117f8..9b26d70fc 100644 --- a/apps/spreadsheeteditor/mobile/src/store/focusObjects.js +++ b/apps/spreadsheeteditor/mobile/src/store/focusObjects.js @@ -44,19 +44,19 @@ export class storeFocusObjects { for (let object of this._focusObjects) { const type = object.get_ObjectType(); - if (Asc.c_oAscTypeSelectElement.Paragraph == type) { + if (Asc.c_oAscTypeSelectElement.Paragraph === type) { _objects.push('text', 'paragraph'); - } else if (Asc.c_oAscTypeSelectElement.Table == type) { + } else if (Asc.c_oAscTypeSelectElement.Table === type) { _objects.push('table'); - } else if (Asc.c_oAscTypeSelectElement.Image == type) { + } else if (Asc.c_oAscTypeSelectElement.Image === type) { if (object.get_ObjectValue().get_ChartProperties()) { _objects.push('chart'); - } else if (object.get_ObjectValue().get_ShapeProperties()) { + } else if (object.get_ObjectValue().get_ShapeProperties() && !_objects.includes('chart')) { _objects.push('shape'); } else { _objects.push('image'); } - } else if (Asc.c_oAscTypeSelectElement.Hyperlink == type) { + } else if (Asc.c_oAscTypeSelectElement.Hyperlink === type) { _objects.push('hyperlink'); } }