ckeditor5-elements / ElementQuickInsert
Class: ElementQuickInsert
Opens a menu with a search field and the elements allowed at the selection, on Alt+Enter (Option+Enter on macOS; see ElementQuickInsertConfig.keystroke). Choosing an element inserts it with the quickInsert command.
The menu is shown by the ElementMenu plugin. The quickInsertBefore and quickInsertAfter commands (see QuickInsertPositionCommand) open it for the position before or after an element; list them in the elementContextMenu config, e.g. as an "Insert" submenu.
The menu closes when the document changes while it is open, so it never inserts at an outdated position.
Extends
Constructors
Constructor
new ElementQuickInsert(editor): ElementQuickInsert;Parameters
| Parameter | Type |
|---|---|
editor | Editor |
Returns
ElementQuickInsert
Overrides
Plugin.constructor
Accessors
pluginName
Get Signature
get static pluginName(): "ElementQuickInsert";Returns
"ElementQuickInsert"
requires
Get Signature
get static requires(): readonly [typeof ElementMenu];Returns
readonly [typeof ElementMenu]
Methods
getItems()
getItems(elementOrPosition?): QuickInsertItem[];Returns the elements that can be inserted at the target (a position, the position before an element, or the selection), with their labels.
Parameters
| Parameter | Type |
|---|---|
elementOrPosition? | ElementOrPosition |
Returns
hasItems()
hasItems(elementOrPosition?): boolean;Whether an element can be inserted at the target (a position, the position before an element, or the selection), as getItems lists them: it stops at the first one, e.g. for whether a command is enabled.
Parameters
| Parameter | Type |
|---|---|
elementOrPosition? | ElementOrPosition |
Returns
boolean
init()
init(): void;Returns
void
open()
open(elementOrPosition?, domTarget?): boolean;Opens the menu for inserting at the target (a position, the position before an element, or the selection), next to the given DOM target. By default, the menu is next to the element, or the selection.
Returns false when nothing can be inserted at the target because it cannot be edited, or there is nothing to show the menu next to.
Parameters
| Parameter | Type |
|---|---|
elementOrPosition? | ElementOrPosition |
domTarget? | RectSource |
Returns
boolean