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.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, HostListener } from '@angular/core';
|
||||||
import { ContextMenuService } from './../services/context-menu.service';
|
import { ContextMenuService } from './../services/context-menu.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -52,10 +52,6 @@ import { ContextMenuService } from './../services/context-menu.service';
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
],
|
],
|
||||||
host:{
|
|
||||||
'(document:click)':'clickedOutside()'
|
|
||||||
// '(click)':'clickInside()'
|
|
||||||
},
|
|
||||||
template: `
|
template: `
|
||||||
<div [ngStyle]="locationCss" class="menu-container">
|
<div [ngStyle]="locationCss" class="menu-container">
|
||||||
<ul class="context-menu">
|
<ul class="context-menu">
|
||||||
@ -85,6 +81,7 @@ export class ContextMenuHolderComponent {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('document:click')
|
||||||
clickedOutside() {
|
clickedOutside() {
|
||||||
this.isShown = false;
|
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.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Directive, Input } from '@angular/core';
|
import { Directive, Input, HostListener } from '@angular/core';
|
||||||
import { ContextMenuService } from './../services/context-menu.service';
|
import { ContextMenuService } from './../services/context-menu.service';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector:'[context-menu]',
|
selector:'[context-menu]'
|
||||||
host: {
|
|
||||||
'(contextmenu)':'onShowContextMenu($event)'
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
export class ContextMenuDirective {
|
export class ContextMenuDirective {
|
||||||
@Input('context-menu')
|
@Input('context-menu')
|
||||||
@ -31,6 +28,7 @@ export class ContextMenuDirective {
|
|||||||
constructor(
|
constructor(
|
||||||
private _contextMenuService: ContextMenuService) {}
|
private _contextMenuService: ContextMenuService) {}
|
||||||
|
|
||||||
|
@HostListener('contextmenu', ['$event'])
|
||||||
onShowContextMenu(event?: MouseEvent) {
|
onShowContextMenu(event?: MouseEvent) {
|
||||||
if (event) {
|
if (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user