Module

typing/utils/findattributerange

@ckeditor/ckeditor5-typing/src/utils/findattributerange

module

Filtering

Functions

  • findAttributeRange( position, attributeName, value, model ) → Range

    Returns a model range that covers all consecutive nodes with the same attributeName and its value that intersect the given position.

    It can be used e.g. to get the entire range on which the linkHref attribute needs to be changed when having a selection inside a link.

    Parameters

    position : Position

    The start position.

    attributeName : string

    The attribute name.

    value : unknown

    The attribute value.

    model : Model

    The model instance.

    Returns

    Range

    The link range.

  • findAttributeRangeBound( position, attributeName, value, lookBack, model ) → Position

    Walks forward or backward (depends on the lookBack flag), node by node, as long as they have the same attribute value and returns a position just before or after (depends on the lookBack flag) the last matched node.

    Parameters

    position : Position

    The start position.

    attributeName : string

    The attribute name.

    value : unknown

    The attribute value.

    lookBack : boolean

    Whether the walk direction is forward (false) or backward (true).

    model : Model

    Returns

    Position

    The position just before the last matched node.