Mentions
The HTML editor supports mentions, the CKEditor feature that lets users insert references such as @name by typing a trigger character and choosing an entry from a suggestion list. ADITO exposes this feature through the mentionFeeds property of an HTML entity field.
How it works
When mentions are configured for an HTML field, typing the configured marker (for example @) opens a suggestion list. The user selects an entry, which is then inserted as a mention into the field content.
Each suggestion list is defined by a feed. A field can provide several feeds, each with its own marker, so different trigger characters can offer different sets of suggestions.
Configuration
Mentions are configured per entity field through the mentionFeeds property.
| Property | Description |
|---|---|
mentionFeeds | A process that returns a JSON string. The string must contain an array of feed objects that determine which mentions the HTML editor offers. |
The mentionFeeds property belongs to the contentType property group, so it is only available for fields that use the HTML content type.
Each feed object supports the following keys:
| Key | Description |
|---|---|
marker | The character that triggers the suggestion list, for example @. |
feed | The list of suggestions offered for this marker. |
minimumCharacters | The number of characters that must be typed after the marker before the suggestion list opens. |
Example
The process must return the feed configuration as a JSON string:
import { result } from "@aditosoftware/jdito-types";
result.string(JSON.stringify([
{
marker: '@',
feed: ['@Barney', '@Lily', '@Marry Ann', '@Marshall'],
minimumCharacters: 1
}
]));
For the full set of supported feed options, see the CKEditor Mentions documentation.