Class

TextWatcher (typing)

@ckeditor/ckeditor5-typing/src/textwatcher

class private

The text watcher feature.

Fires the matched:data, matched:selection and unmatched events on typing or selection changes.

Filtering

Methods

  • constructor( model, testCallback )

    Creates a text watcher instance.

    Parameters

    model : Model
    testCallback : function

    The function used to match the text.

  • _evaluateTextBeforeSelection( suffix, data )

    private

    Checks the editor content for matched text.

    Parameters

    suffix : 'data' | 'selection'

    A suffix used for generating the event name.

    data : Object

    Data object for event.

    Fires

  • _startListening()

    private

    Starts listening to the editor for typing and selection events.

Events

  • matched:data( eventInfo, data = { data.text, data.batch } )

    Fired whenever the text watcher found a match for data changes.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

    data : Object

    Event data.

    Properties
    data.text : String

    The full text before selection.

    data.batch : Batch

    A batch associated with a change.

  • matched:selection( eventInfo, data = { data.text } )

    Fired whenever the text watcher found a match for selection changes.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

    data : Object

    Event data.

    Properties
    data.text : String

    The full text before selection.

  • unmatched( eventInfo )

    Fired whenever the text does not match anymore. Fired only when the text watcher found a match.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.