Closed sroucheray closed 2 years ago
Implemented in 8.1.0 and forward ported to 14.1.0
Are you planning to port it in v16?
Hi @michelebenolli, it's here https://www.npmjs.com/package/@perfectmemory/ngx-contextmenu?activeTab=versions
Unfortunately, with v16.0.0 I'm still not able to open the menu with left click, following the instructions above
Could you provide a stackblitz with a minimum reproduction of your problem ?
OK, there is a subtle error in the example. The exact syntax is
(click)="contextMenu.open($event)"
for mouse events do not forget the $event parameter
(keydown.enter)="contextMenu.open()"
for keyboard this is not required
Thank you (:
Request 1
As a user of the
@perfectmemory/ngx-contextmenu
library, I want to be able to open the contextmenu by other mean than thecontextmenu
event, to make the contextmenu available on Safari iOS which does not support this event see https://developer.mozilla.org/en-US/docs/Web/API/Element/contextmenu_event#browser_compatibility and https://bugs.webkit.org/show_bug.cgi?id=213953. This was requested here https://github.com/PerfectMemory/ngx-contextmenu/issues/8Request 2
As a user of the
@perfectmemory/ngx-contextmenu
library, I want to be able to close all contextmenu programmatically, to make sure none of them are displayed when my page layout changes somehow. This was requested here https://github.com/PerfectMemory/ngx-contextmenu/issues/9Notes
In previous version there was a service that was able to do some kind of this work but it was marked as internal, has been refactored and is not to be used anymore outside the library. Thus it is not documented.
This specification intends to document what we need to add to the library to provide those 2 features.
Implementation
open
andclose
should be made available on thecontextmenu
directive.open
method won't have any parameter and will open thecontextmenu
at the bottom left of the DOM element where the directive is attached.close
method won't have any parameter and, when called, will completely close the current contextmenu including submenus.ngxContextMenu
Usage
Those usage should work:
Shift+Y
is pressedEnter
is pressedThe implementation should include code, associated unit tests and documentation with examples.
EDIT: 2023-06-15 add $event property to the example where required