Module

engine/model/position

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

module

Filtering

Classes

  • Position

Type Definitions

Functions

  • getNodeAfterPosition( position, positionParent, textNode ) → Node | null

    Returns 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 with Position#parent and/or Position#textNode check 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 : Position

    Position to check.

    positionParent : Element | DocumentFragment

    The parent of the given position.

    textNode : null | Text

    Text node at the given position.

    Returns

    Node | null
  • getNodeBeforePosition( position, positionParent, textNode ) → Node | null

    Returns the node before the given position.

    Refer to getNodeBeforePosition for documentation on when to use this util method.

    See also:

    Parameters

    position : Position

    Position to check.

    positionParent : Element | DocumentFragment

    The parent of the given position.

    textNode : null | Text

    Text node at the given position.

    Returns

    Node | null
  • getTextNodeAtPosition( position, positionParent ) → Text | null

    Returns 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 with Position#parent check 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 : Position
    positionParent : Element | DocumentFragment

    The parent of the given position.

    Returns

    Text | null