Interface

SchemaContextItem (engine/model)

@ckeditor/ckeditor5-engine/src/model/schema

interface

An item of the schema context.

It contains 3 properties:

  • name – the name of this item,
  • * getAttributeKeys() – a generator of keys of item attributes,
  • getAttribute( keyName ) – a method to get attribute values.

The context item interface is a highly simplified version of Node and its role is to expose only the information which schema checks are able to provide (which is the name of the node and node's attributes).

schema.on( 'checkChild', ( evt, args ) => {
	const ctx = args[ 0 ];
	const firstItem = ctx.getItem( 0 );

	console.log( firstItem.name ); // -> '$root'
	console.log( firstItem.getAttribute( 'foo' ) ); // -> 'bar'
	console.log( Array.from( firstItem.getAttributeKeys() ) ); // -> [ 'foo', 'faa' ]
} );

Filtering

Properties

  • name : string

Methods

  • getAttribute( keyName ) → unknown

    Parameters

    keyName : string

    Returns

    unknown
  • getAttributeKeys() → Generator<string, any, unknown>

    Returns

    Generator<string, any, unknown>