Report an issue
Class

TextWatcher (mention)

@ckeditor/ckeditor5-mention/src/textwatcher

class private

The text watcher feature.

Fires matched and unmatched events on typing or selection changes.

Filtering

Properties

  • last

    The last matched text.

Methods

  • constructor( editor, testCallback, textMatcherCallback )

    Creates a text watcher instance.

    Parameters

    editor : Editor
    testCallback : function

    The function used to match the text.

    textMatcherCallback : function

    The function used to process matched text.

  • _evaluateTextBeforeSelection()

    private

    Checks the editor content for matched text.

  • _getText() → String | undefined

    private

    Returns the text before the caret from the current selection block.

    Returns

    String | undefined

    The text from the block or undefined if the selection is not collapsed.

  • _startListening()

    private

    Starts listening to the editor for typing and selection events.

Events

  • matched( eventInfo )

    Fired whenever the text watcher found a match.

    Parameters

    eventInfo : EventInfo

    An object containing information about the fired event.

  • 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.