ViewConversionApi (engine/conversion)
@ckeditor/ckeditor5-engine/src/conversion/upcastdispatcher
Conversion interface that is registered for given UpcastDispatcher
and is passed as one of parameters when dispatcher
fires it's events.
Filtering
Methods
-
convertChildren( viewItem, modelCursor ) → ObjectStarts conversion of all children of given item by firing appropriate events for all those children.
-
convertItem( viewItem, modelCursor ) → ObjectStarts conversion of given item by firing an appropriate event.
Every fired event is passed (as first parameter) an object with
modelRangeproperty. Every event may set and/or modify that property. When all callbacks are done, the final value ofmodelRangeproperty is returned by this method. ThemodelRangemust be model range ornull(as set by default).Parameters
Returns
Objectresult Conversion result.
Range | nullresult.modelRange Model range containing result of item conversion, created and modified by callbacks attached to fired event, or
nullif the conversion result was incorrect.Positionresult.modelCursor Position where conversion should be continued.
Fires
-
splitToAllowedParent( position, node ) → Object | nullChecks schema to find allowed parent for element that we are going to insert starting from given position. If current parent does not allow to insert element but one of the ancestors does then split nodes to allowed parent.
If schema allows to insert node in given position, nothing is split and object with that position is returned.
If it was not possible to find allowed parent,
nullis returned, nothing is split.Otherwise, ancestors are split and object with position and the copy of the split element is returned.
For instance, if
<image>is not allowed in<paragraph>but is allowed in$root:<paragraph>foo[]bar</paragraph> -> split for `<image>` -> <paragraph>foo</paragraph>[]<paragraph>bar</paragraph>In the sample above position between
<paragraph>elements will be returned aspositionand the secondparagraphascursorParent.Parameters
Returns