Skip to content

ckeditor5-elements / ElementSchemaCommands

Class: ElementSchemaCommands ​

A command, a toolbar button and a keystroke for every element of the element schema, formatting included: the command of an element is the one of its kind (see ElementCommand), and works as the CKEditor feature of that kind.

ElementCommandWorks as CKEditor's
inline blockElementInlineCommandbold: wraps text
blockElementBlockCommandheading: renames blocks
containerElementContainerCommandblock quote: wraps blocks
empty, inline containerElementInsertCommandhorizontal line: inserts
container with listItemElementListCommandlists: wraps blocks in items
ts
elementSchema: schema,
elementSchemaCommands: {
  bold: { title: 'Bold', icon: IconBold, keystroke: 'Ctrl+B' },
  callout: { title: 'Callout', icon: IconQuote },
  divider: { title: 'Divider', icon: IconHorizontalLine }
},
toolbar: ['bold', 'callout', 'divider']

Each key is the name of the command and of its toolbar button. The commands have titles and icons, so they can be menu items too, e.g. of the context menu.

The commands are made when the elements are registered, after ElementSchema and the other plugins are initialized. The editor is not created when an element is unknown.

Extends ​

Constructors ​

Constructor ​

ts
new ElementSchemaCommands(editor): ElementSchemaCommands;

Parameters ​

ParameterType
editorEditor

Returns ​

ElementSchemaCommands

Inherit Doc ​

Inherited from ​

Plugin.constructor

Accessors ​

pluginName ​

Get Signature ​

ts
get static pluginName(): "ElementSchemaCommands";
Returns ​

"ElementSchemaCommands"


requires ​

Get Signature ​

ts
get static requires(): readonly [typeof ElementSchema];
Returns ​

readonly [typeof ElementSchema]

Methods ​

afterInit() ​

ts
afterInit(): void;

Makes the commands of the elements, which are registered then.

Returns ​

void


init() ​

ts
init(): void;

Returns ​

void