Report an issue
Class

CKEDITOR.plugins.mentions

class since 4.10.0

The Mentions plugin allows you to type a marker character and get suggested values for the text matches so that you do not have to write it on your own.

The recommended way to add the mentions feature to an editor is by setting the config.mentions option:

// Passing mentions configuration when creating the editor.
CKEDITOR.replace( 'editor', {
        mentions: [ { feed: ['Anna', 'Thomas', 'John'], minChars: 0 } ]
} );

// Simple usage with the CKEDITOR.config.mentions property.
CKEDITOR.config.mentions = [ { feed: ['Anna', 'Thomas', 'John'], minChars: 0 } ];

Filtering

Properties

  • cache : Boolean

    readonly

    Indicates if the URL feed responses will be cached.

    The cache is based on the URL request and is shared between all mentions instances (including different editors).

    Defaults to true

  • caseSensitive : Boolean

    readonly

    Indicates that a mentions instance is case-sensitive for simple items feed, i.e. an array feed.

    Note: This will take no effect on feeds using a callback or URLs, as in this case the results are expected to be already filtered.

    Defaults to false

  • marker : String

    readonly

    The character that should trigger autocompletion.

    Defaults to '@'

  • minChars : Number

    readonly

    The number of characters that should follow the marker character in order to trigger the mentions feature.

    Defaults to 2

  • pattern : RegExp

    readonly

    The pattern used to match queries.

    The default pattern matches words with the query including the config.marker and config.minChars properties.

    // Match only words starting with "a".
    var pattern = /^a+\w*$/;
    
  • throttle : Number

    readonly

    Indicates throttle threshold expressed in milliseconds, reducing text checks frequency.

    Defaults to 200

  • _autocomplete : autocomplete

    private

    Autocomplete instance used by the mentions feature to implement autocompletion logic.

Methods

  • constructor( editor, config ) → mentions

    Creates a new instance of mentions and attaches it to the editor.

    Parameters

    editor : editor

    The editor to watch.

    config : configDefinition

    Configuration object keeping information about how to instantiate the mentions plugin.

    Returns

    mentions
  • destroy()

    Destroys the mentions instance.

    The view element and event listeners will be removed from the DOM.