Closed theRealProHacker closed 1 year ago
The internal functionality for context menus was implemented in #67, however the API was not finalized. ATM the event manager uses a default context menu for all elements. Instead, every Element will have a context_menu
attribute that determines the specific context menu. For special elements, this can then be customized with a getter. context_menu
will never be set from positron
.
To customize context menus, developers can set elements context_menu
to whatever they like. In the case that context_menu
is falsy, no context menu will be drawn.
Implemented with working API
When you release the right mouse button over an element, it will trigger the activation of a context menu. This context menu depends on the elements you are on right now. The context menu of an anchor could include
copy link
for a regular link,call number
for a telephone link, orwrite e-mail
for amailto
-link. Custom elements should be able to create their own context menus.Now there arises a small question. The context menu on an image inside an anchor will both contain the menu items for image and for anchor.
So we need to implement an API that allows for this flexibility.