ckeditor5-elements / ElementMenu
Class: ElementMenu
Shows menus in a balloon: the menu of an element, built from commands, submenus and separators (see open), or any view, e.g. the quick insert search (see show).
The element context menu, the breadcrumbs and quick insert show their menus with it. The menu of an element is CKEditor's dropdown menu (see ElementMenuView).
Executing an item closes the menu. Esc and clicking outside close it too; Esc returns the focus to the editor, or to ElementMenuShowOptions.returnFocusTo.
Extends
Constructors
Constructor
new ElementMenu(editor): ElementMenu;Parameters
| Parameter | Type |
|---|---|
editor | Editor |
Returns
ElementMenu
Inherit Doc
Inherited from
Plugin.constructor
Properties
view
view:
| FocusableView
| null = null;The view in the open menu, if any.
Accessors
pluginName
Get Signature
get static pluginName(): "ElementMenu";Returns
"ElementMenu"
requires
Get Signature
get static requires(): readonly [typeof ContextualBalloon, typeof Notification];Returns
readonly [typeof ContextualBalloon, typeof Notification]
Methods
destroy()
destroy(): void;Returns
void
Inherit Doc
Overrides
Plugin.destroy
hide()
hide(): void;Hides the open menu, if any.
Returns
void
init()
init(): void;Returns
void
open()
open(
element,
target,
config,
__namedParameters?
): boolean;Opens the menu of the element next to the target (e.g. a button, or a DOMRect in viewport coordinates), with the items from the config callback. The menu closes when the element is removed.
Returns false when there are no items.
Parameters
| Parameter | Type |
|---|---|
element | ModelElement |
target | RectSource |
config | ElementMenuConfig |
__namedParameters? | ElementMenuShowOptions |
Returns
boolean
show()
show(
view,
target,
__namedParameters?
): void;Shows the view (e.g. a menu) next to the target (e.g. a button, or a DOMRect in viewport coordinates), and focuses it. The menu closes when the view, or an item of CKEditor's dropdown menu in it, fires execute.
Parameters
| Parameter | Type |
|---|---|
view | FocusableView |
target | RectSource |
__namedParameters? | ElementMenuShowOptions |
Returns
void