CKEDITOR.plugins.mentions
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
-
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
-
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
-
Indicates if a following space should be added after inserted match into an editor.
-
-
The number of characters that should follow the marker character in order to trigger the mentions feature.
Defaults to
2
-
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*$/;
-
Indicates throttle threshold expressed in milliseconds, reducing text checks frequency.
Defaults to
200
-
Autocomplete instance used by the mentions feature to implement autocompletion logic.
Methods
-
constructor( editor, config ) → mentions
CKEDITOR.plugins.mentions#constructor
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()
CKEDITOR.plugins.mentions#destroy
Destroys the mentions instance.
The view element and event listeners will be removed from the DOM.