The DOM document for which to make this context menu.
Position of the menu. The context menu may ignore this position if the menu would appear off-screen.
Position of the menu.
An array of action information in the form of anonymous
objects. It is valid to have some items in the array be of the form
{action: null, item: some_element, data: null}
to insert arbitrary menu
items.
Function to call when the menu is dismissed.
The jQuery equivalent of menu.
The jQuery equivalent of toggle.
The Element
that contains the list of menu items. This Element
is
an HTML list. It is created at construction of the object and deleted only
when the object is destroyed. This is what the ContextMenu.render
method should populate.
The toggle element of the dropdown menu. Even though it is not shown for our menus, it is necessary, and plays a role in how the menu works.
Dismisses the menu.
Generated using TypeDoc
A context menu for displaying actions. This class is designed to know how to sort "wed/action".Action objects and "wed/transformation".Transformation objects and how to filter them. Even though the names used here suggest that
Action
objects are the focus of this class, the fact is that it is really performing its work onTransformation
objects. It does acceptAction
as a kind of lameTransformation
. So the following description will focus onTransformation
objects rather thanAction
objects.Sorting is performed first by the
kind
of theTransformation
and then by the text associated with theTransformation
. The kinds, in order, are:other kinds than those listed below
undefined
kind
"add"
"delete"
"wrap"
"unwrap"
The text associated with the transformation is the text value of the DOM
Element
object stored in theitem
field of the object given in theitems
array passed to the constructor.Actions
are considered to have an undefinedkind
.Filtering is performed by
kind
and on the text of the element name associated with a transformation. This class presents to the user a row of buttons that represent graphically the possible filters. Clicking on a button will reduce the list of displayed items only to those elements that correspond to thekind
to which the button corresponds.Typing text (e.g. "foo") will narrow the list of items to the text that the user typed. Let's suppose that
item
is successively taking the values in theitems
array. The filtering algorithm first checks whether there is anitem.data.name
field. If there is, the match is performed against this field. If not, the match is performed against the text ofitem.item
.If the text typed begins with a caret (^), the text will be interpreted as a regular expression.
Typing ESCAPE will reset filtering.
When no option is focused, typing ENTER will select the first option of the menu.