Skip to content

ckeditor5-elements / ElementSchemaElement

Interface: ElementSchemaElement ​

The definition of one element of an element schema.

Properties ​

allowAttributes? ​

ts
allowAttributes?: string[];

The attributes the element can have, as in CKEditor's allowAttributes.


allowChildren? ​

ts
allowChildren?: string[];

The elements allowed inside this one, in addition to what its type allows: names of elements of the schema, or of elements of other plugins, and '$text'. As in CKEditor's allowChildren.

What a type allows by default: a block has text and inline elements; a container has blocks, containers and empty block-level elements.


allowIn? ​

ts
allowIn?: string[];

The elements this one is allowed in, in addition to what its type allows: names of elements, and '$root'. As in CKEditor's allowIn.

Unlike in CKEditor, when it is given it replaces the default places (a block-level element is allowed in the root and in containers; an inline element, where text is), so that an element can be restricted to its parent, e.g. a row to a table.


editingTag? ​

ts
editingTag?: string;

The tag of the element in the editing view only, e.g. 'section', when the converters of the schema are on (the elementSchemaConverters option). Default: the tag of the data.


isInline? ​

ts
isInline?: boolean;

Whether the element is inline: it is about the position and the layout of the element, not about text. An inline element is laid out in a line with its siblings, where a block-level one has a line of its own. Any type can be:

  • empty: like an inline image, or a line break;
  • block: an element with text in a line of text, like a bold, a link or a term, with attributes of its own;
  • container: a box that is not typable, in a line with other boxes, e.g. several in a block.

Inline elements are allowed only in blocks: by default, where text is. A block holds text and any number of inline elements; containers and the root hold no inline elements. Default: false.


listItem? ​

ts
listItem?: string;

Makes the container a list: the name of the element of its items, a block-level container of the schema, e.g. "listItem": "listitem". The list holds only its items, and the item is allowed only in its lists, so it has no allowIn, and the list no allowChildren. Enter in an item makes the next item, and leaves the list in an empty one. Several lists can have the same item, e.g. a bulleted and a numbered list.


tag? ​

ts
tag?: string;

The tag of the element, in the data and in the editing view, e.g. 'strong' or 'hr', when the converters of the schema are on (the elementSchemaConverters option): the element is that tag, with no class. Two elements cannot have the same tag. Default: a div or a span, with the name of the element as its class.


type ​

ts
type: ElementSchemaType;

What the element is: 'empty', 'block' or 'container'.


verbatim? ​

ts
verbatim?: boolean;

Whether the block is verbatim: its whitespace is its content, e.g. code, a literal layout or a poem. It keeps its spaces and its new lines; Enter inserts a new line in it, and leaves it on an empty last line. Only a block-level block can be verbatim. With the converters of the schema, it is a pre. Default: false.