mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
support for toggling custom context menu (#1683)
* support for toggling custom context menu * fix unit tests
This commit is contained in:
committed by
Mario Romano
parent
0f718a56d7
commit
a3cda4d958
@@ -25,18 +25,23 @@ export class ContextMenuDirective {
|
||||
@Input('context-menu')
|
||||
links: any[];
|
||||
|
||||
@Input('context-menu-enabled')
|
||||
enabled: boolean = false;
|
||||
|
||||
constructor(private _contextMenuService: ContextMenuService) {
|
||||
}
|
||||
|
||||
@HostListener('contextmenu', ['$event'])
|
||||
onShowContextMenu(event?: MouseEvent) {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
if (this.enabled) {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (this.links && this.links.length > 0) {
|
||||
if (this._contextMenuService) {
|
||||
this._contextMenuService.show.next({event: event, obj: this.links});
|
||||
if (this.links && this.links.length > 0) {
|
||||
if (this._contextMenuService) {
|
||||
this._contextMenuService.show.next({event: event, obj: this.links});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user