Namespace wpModules.contextMenu
Constructor Attributes | Constructor Name and Description |
---|---|
The static class used for all context menu related operations.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
wpModules.contextMenu.init(jsonObject)
Initializes a context menu for the specified node using the provided
menuId.
|
<static> |
wpModules.contextMenu.invalidate(id)
Public function which allows for invalidating the content of a menu.
|
<static> |
wpModules.contextMenu.lock(node)
Locks the menu functionality on the provided node and cancels any events that would open a new menu.
|
<static> |
wpModules.contextMenu.register(jsonObject)
The register method registers a menu handler to the provided DOM node,
which will open the menu if the provided node or one of it's children
(that doesn't have a menu attached) was hovered for more than 500ms.
|
<static> |
wpModules.contextMenu.reposition(node)
Repositions any open menu that is attached to the provided node.
|
<static> |
wpModules.contextMenu.unlock(node)
Unlocks the menu functionality on the provided node and resets the behavior.
|
<static> |
wpModules.contextMenu.unregister(nodeOrHandle)
The unregister method un-registers a menu handler from either the
provided node or removes the handler with the provided handle.
|
Namespace Detail
wpModules.contextMenu
The static class used for all context menu related operations.
Method Detail
<static>
wpModules.contextMenu.init(jsonObject)
Initializes a context menu for the specified node using the provided
menuId.
- Parameters:
- {JSON} jsonObject
- an object to pass the parameters
- {DOMNode} jsonObject.node
- the node to create the menu for
- {String} jsonObject.menuId
- the id of the menu to create for the node
- {JSON} jsonObject.params Optional
- JSON type object that to finer configure the menu
- {String} jsonObject.params.templateId
- defines a DOM node id for a template that should be used rather than the default template
- {String} jsonObject.params.menuTrigger
- the name of the menu-trigger to use.
The default event handler provides
hover
andclick
triggers, if not specified the defaulthover
is used. - {JSON} jsonObject.jsonQuery Optional
- an additional parameter that allows to provide arbitrary query parameters that will be sent to the backend. Can be null
<static>
wpModules.contextMenu.invalidate(id)
Public function which allows for invalidating the content of a menu.
This will enforce a reload of the menu feed.
- Parameters:
- {String} id
- The ID of the menu instance.
<static>
wpModules.contextMenu.lock(node)
Locks the menu functionality on the provided node and cancels any events that would open a new menu.
Any menus that are already open will not be touched by this functionality.
- Parameters:
- {DOMNode} node
- the node for which to lock the menu
<static>
{String}
wpModules.contextMenu.register(jsonObject)
The register method registers a menu handler to the provided DOM node,
which will open the menu if the provided node or one of it's children
(that doesn't have a menu attached) was hovered for more than 500ms.
var handle = wptheme.contextMenu.register(myNode, componentActionMenu"); wptheme.contextMenu.unregister(handle);
- Parameters:
- {JSON} jsonObject
- the object to pass the parameters
- {DOMNode} jsonObject.node
- the node to create the menu for
- {String} jsonObject.menuId
- the id of the menu to create for the node
- {JSON} jsonObject.params Optional
- JSON type object that to finer configure the menu
- {String} jsonObject.params.templateId
- defines a DOM node id for a template that should be used rather than the default template
- {String} jsonObject.params.menuTrigger
- the name of the menu-trigger to use.
The default event handler provides
hover
andclick
triggers, if not specified the defaulthover
is used. - {int} jsonObject.params.hoverTimeout
- The delay after hover, in ms, before the menu will appear. Only observed for the default 'hover' menu trigger.
- {int} jsonObject.params.blurTimeout
- The delay after blur, in ms, before the menu will disappear. Only observed for the default 'hover' menu trigger.
- {JSON} jsonObject.jsonQuery Optional
- an additional parameter that allows to provide arbitrary query parameters that will be sent to the backend. If jsonObject.menuItems is set, this property is ignored.
- {JSON} jsonObject.menuItems Optional
- Allows menu items to be specified inline. If this property is set, jsonQuery is ignored. No request will be sent to retrieve menu items from the backend.
- Returns:
- {String} the handle for the registered handler or null if there was a problem registering the handler
<static>
wpModules.contextMenu.reposition(node)
Repositions any open menu that is attached to the provided node.
- Parameters:
- {DOMNode} node
- the node for which to reposition the menu
<static>
wpModules.contextMenu.unlock(node)
Unlocks the menu functionality on the provided node and resets the behavior.
- Parameters:
- {DOMNode} node
- the node for which to un-lock the menu
<static>
wpModules.contextMenu.unregister(nodeOrHandle)
The unregister method un-registers a menu handler from either the
provided node or removes the handler with the provided handle.
- Parameters:
- {DOMNode|String} nodeOrHandle
- the node the menu was registered for or the handle returned by the register call