ckeditor5-elements / validateElementSchema
Function: validateElementSchema()
ts
function validateElementSchema(input, __namedParameters?): ElementSchemaIssue[];Checks an element schema, so that it is not contradictory, and returns the problems. An empty array means that the schema is valid.
The schema is rejected when it:
- is not of the shape ElementSchemaDefinition: an object of elements, by name; has keys that are not part of it (typos are problems), or has values of the wrong type;
- declares an element with an unknown
type, or anemptyelement withallowChildren; - has attribute names that are not valid, or that differ only in case (HTML attribute names are not case sensitive), or a
tagor aneditingTagthat is not the name of a tag, or thetagof another element; - refers to elements that do not exist (a name that is neither declared in the schema, nor in
external), or lists the same name twice; - allows what its type cannot hold: text or an inline element in a container or in the root, a block-level (not inline) element in a block, or anything in an
emptyelement, whichever side says it:allowChildrenof the parent, orallowInof the child; - makes verbatim what is not a block-level
block, or a list of what is not a block-levelcontainer; names a list item that is not a block-level container of the schema, or gives itallowIn(its places are its lists); gives a listallowChildren, or allows another element in a list, which holds only its items.
isInline is about the position and the layout of an element, so it is valid for every type: an inline element is laid out in a line with its siblings. Inline elements are allowed only in blocks, which can hold several of them, e.g. inline containers, or inline images between text.
It does not need an editor. The editor of ElementSchema runs it with the elements of the other plugins as external.
Parameters
| Parameter | Type |
|---|---|
input | unknown |
__namedParameters? | ValidateElementSchemaOptions |