Merge pull request #1887 from ONLYOFFICE/feature/Bug_51540
Feature/bug 51540
This commit is contained in:
		
						commit
						3bd82d5253
					
				| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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');
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue