diff --git a/platform/commonUI/general/res/templates/tree-node.html b/platform/commonUI/general/res/templates/tree-node.html index 885646d606..5659f69cbf 100644 --- a/platform/commonUI/general/res/templates/tree-node.html +++ b/platform/commonUI/general/res/templates/tree-node.html @@ -39,6 +39,7 @@ class="mobile-hide" key="'label'" mct-object="domainObject" + parameters="{suppressMenuOnEdit: true}" ng-click="treeNode.select()" > diff --git a/platform/representation/bundle.json b/platform/representation/bundle.json index c1ec13fd6c..43ba1ec5e7 100644 --- a/platform/representation/bundle.json +++ b/platform/representation/bundle.json @@ -27,7 +27,8 @@ { "key": "menu", "implementation": "gestures/ContextMenuGesture.js", - "depends": ["$timeout", "agentService"] + "depends": ["$timeout", "$parse", "agentService", + "navigationService"] } ], "components": [ diff --git a/platform/representation/src/actions/ContextMenuAction.js b/platform/representation/src/actions/ContextMenuAction.js index 53cc51a253..a7cdee04b8 100644 --- a/platform/representation/src/actions/ContextMenuAction.js +++ b/platform/representation/src/actions/ContextMenuAction.js @@ -82,11 +82,7 @@ define( initiatingEvent = this.agentService.isMobile() ? 'touchstart' : 'mousedown', menu, - popup; - - if (this.navigationService.getNavigation() && this.navigationService.getNavigation().hasCapability('editor')){ - return; - } + popup // Remove the context menu function dismiss() { diff --git a/platform/representation/src/gestures/ContextMenuGesture.js b/platform/representation/src/gestures/ContextMenuGesture.js index e7c0c7ba9f..97d500defb 100644 --- a/platform/representation/src/gestures/ContextMenuGesture.js +++ b/platform/representation/src/gestures/ContextMenuGesture.js @@ -41,16 +41,33 @@ define( * in the context menu will be performed * @implements {Gesture} */ - function ContextMenuGesture($timeout, agentService, element, domainObject) { + function ContextMenuGesture($timeout, $parse, agentService, navigationService, element, domainObject) { var isPressing, - longTouchTime = 500; + longTouchTime = 500, + parameters = element && element.attr('parameters') && $parse(element.attr('parameters'))() + + function suppressMenu(){ + return parameters + && parameters.suppressMenuOnEdit + && navigationService.getNavigation() + && navigationService.getNavigation().hasCapability('editor'); + } function showMenu(event) { - domainObject.getCapability('action').perform({ - key: 'menu', - domainObject: domainObject, - event: event - }); + /** + * Some menu items should have the context menu action + * suppressed (eg. the navigation menu on the left) + */ + if (suppressMenu()){ + return; + } else { + domainObject.getCapability('action').perform({ + key: 'menu', + domainObject: domainObject, + event: event, + element: element + }); + } } // When context menu event occurs, show object actions instead