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

  • readonly

    cache : Boolean

    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

  • readonly

    caseSensitive : Boolean

    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

  • since 4.20.0 readonly

    followingSpace : Boolean

    Indicates if a following space should be added after inserted match into an editor.

  • readonly

    marker : String

    The character that should trigger autocompletion.

    Defaults to '@'

  • readonly

    minChars : Number

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

    Defaults to 2

  • readonly

    pattern : RegExp

    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*$/;
    
  • readonly

    throttle : Number

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

    Defaults to 200

  • private

    _autocomplete : autocomplete

    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.