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 ) → Object
Starts conversion of all children of given item by firing appropriate events for all those children.
-
convertItem( viewItem, modelCursor ) → Object
Starts conversion of given item by firing an appropriate event.
Every fired event is passed (as first parameter) an object with
modelRange
property. Every event may set and/or modify that property. When all callbacks are done, the final value ofmodelRange
property is returned by this method. ThemodelRange
must be model range ornull
(as set by default).Parameters
Returns
Object
result Conversion result.
Range | null
result.modelRange Model range containing result of item conversion, created and modified by callbacks attached to fired event, or
null
if the conversion result was incorrect.Position
result.modelCursor Position where conversion should be continued.
Fires
-
splitToAllowedParent( position, node ) → Object | null
Checks 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,
null
is 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 asposition
and the secondparagraph
ascursorParent
.Parameters
Returns