mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
#353 Disable right clicks for context menu
This commit is contained in:
parent
50960555cb
commit
9b9e86c817
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, HostListener } from '@angular/core';
|
||||
import { ContextMenuService } from './../services/context-menu.service';
|
||||
|
||||
@Component({
|
||||
@ -52,10 +52,6 @@ import { ContextMenuService } from './../services/context-menu.service';
|
||||
}
|
||||
`
|
||||
],
|
||||
host:{
|
||||
'(document:click)':'clickedOutside()'
|
||||
// '(click)':'clickInside()'
|
||||
},
|
||||
template: `
|
||||
<div [ngStyle]="locationCss" class="menu-container">
|
||||
<ul class="context-menu">
|
||||
@ -85,6 +81,7 @@ export class ContextMenuHolderComponent {
|
||||
};
|
||||
}
|
||||
|
||||
@HostListener('document:click')
|
||||
clickedOutside() {
|
||||
this.isShown = false;
|
||||
}
|
||||
@ -100,4 +97,11 @@ export class ContextMenuHolderComponent {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('contextmenu', ['$event'])
|
||||
onShowContextMenu(event?: MouseEvent) {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,14 +15,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Directive, Input } from '@angular/core';
|
||||
import { Directive, Input, HostListener } from '@angular/core';
|
||||
import { ContextMenuService } from './../services/context-menu.service';
|
||||
|
||||
@Directive({
|
||||
selector:'[context-menu]',
|
||||
host: {
|
||||
'(contextmenu)':'onShowContextMenu($event)'
|
||||
}
|
||||
selector:'[context-menu]'
|
||||
})
|
||||
export class ContextMenuDirective {
|
||||
@Input('context-menu')
|
||||
@ -31,6 +28,7 @@ export class ContextMenuDirective {
|
||||
constructor(
|
||||
private _contextMenuService: ContextMenuService) {}
|
||||
|
||||
@HostListener('contextmenu', ['$event'])
|
||||
onShowContextMenu(event?: MouseEvent) {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
|
Loading…
x
Reference in New Issue
Block a user