Report an issue
Class

LiveRange (engine/model)

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

class

LiveRange is a type of Range that updates itself as document is changed through operations. It may be used as a bookmark.

Note: Be very careful when dealing with LiveRange. Each LiveRange instance bind events that might have to be unbound. Use detach whenever you don't need LiveRange anymore.

Filtering

Methods

  • constructor()

    Creates a live range.

  • detach()

    Unbinds all events previously bound by LiveRange. Use it whenever you don't need LiveRange instance anymore (i.e. when leaving scope in which it was declared or before re-assigning variable that was referring to it).

Static methods

Events

  • change:content( eventInfo, range, data = { data.type, data.batch, data.range, data.sourcePosition } )

    Fired when LiveRange instance boundaries have not changed after a change in document but the change took place inside the range, effectively changing its content.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

    range : Range

    Range with start and end position equal to start and end position of change range.

    data : Object

    Object with additional information about the change. Those parameters are passed from document change event.

    Properties
    data.type : String

    Change type.

    data.batch : Batch

    Batch which changed the live range.

    data.range : Range

    Range containing the result of applied change.

    data.sourcePosition : Position

    Source position for move, remove and reinsert change types.

  • change:range( eventInfo, oldRange, data = { data.type, data.batch, data.range, data.sourcePosition } )

    Fired when LiveRange instance boundaries have changed due to changes in the document.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

    oldRange : Range

    Range with start and end position equal to start and end position of this live range before it got changed.

    data : Object

    Object with additional information about the change. Those parameters are passed from document change event.

    Properties
    data.type : String

    Change type.

    data.batch : Batch

    Batch which changed the live range.

    data.range : Range

    Range containing the result of applied change.

    data.sourcePosition : Position

    Source position for move, remove and reinsert change types.