engine/model/position
Classes
module:engine/model/position~ModelPosition
Type Definitions
module:engine/model/position~ModelPositionOffsetmodule:engine/model/position~ModelPositionRelationmodule:engine/model/position~ModelPositionStickiness
Functions
getNodeAfterPosition( position, positionParent, textNode ) → null | ModelNodeinternalmodule:engine/model/position~getNodeAfterPositionReturns the node after the given position.
This is a helper function optimized to reuse the position parent instance and the calculation of the text node at the specific position for performance reasons.
Normally, you should use
Position#nodeAfter. If you start hitting performance issues withPosition#parentand/orPosition#textNodecheck if your algorithm does not access those properties multiple times (which can happen directly or indirectly via other position properties).See https://github.com/ckeditor/ckeditor5/issues/6579 and https://github.com/ckeditor/ckeditor5/issues/6582.
See also:
Parameters
position : ModelPositionPosition to check.
positionParent : ModelElement | ModelDocumentFragmentThe parent of the given position.
textNode : null | ModelTextText node at the given position.
Returns
null | ModelNode
getNodeBeforePosition( position, positionParent, textNode ) → null | ModelNodeinternalmodule:engine/model/position~getNodeBeforePositionReturns the node before the given position.
Refer to
getNodeBeforePositionfor documentation on when to use this util method.See also:
Parameters
position : ModelPositionPosition to check.
positionParent : ModelElement | ModelDocumentFragmentThe parent of the given position.
textNode : null | ModelTextText node at the given position.
Returns
null | ModelNode
getTextNodeAtPosition( position, positionParent ) → null | ModelTextinternalmodule:engine/model/position~getTextNodeAtPositionReturns a text node at the given position.
This is a helper function optimized to reuse the position parent instance for performance reasons.
Normally, you should use
Position#textNode. If you start hitting performance issues withPosition#parentcheck if your algorithm does not access it multiple times (which can happen directly or indirectly via other position properties).See https://github.com/ckeditor/ckeditor5/issues/6579.
See also:
Parameters
position : ModelPositionpositionParent : ModelElement | ModelDocumentFragmentThe parent of the given position.
Returns
null | ModelText