The mention feed descriptor. Used in config.mention
.
See MentionConfig
to learn more.
// Static configuration.
const mentionFeedPeople = {
marker: '@',
feed: [ '@Alice', '@Bob', ... ],
minimumCharacters: 2
};
// Simple synchronous callback.
const mentionFeedTags = {
marker: '#',
feed: ( searchString: string ) => {
return tags
// Filter the tags list.
.filter( tag => {
return tag.toLowerCase().includes( queryText.toLowerCase() );
} )
}
};
const tags = [ 'wysiwyg', 'rte', 'rich-text-edior', 'collaboration', 'real-time', ... ];
// Asynchronous callback.
const mentionFeedPlaceholders = {
marker: '$',
feed: ( searchString: string ) => {
return getMatchingPlaceholders( searchString );
}
};
function getMatchingPlaceholders( searchString: string ) {
return new Promise<Array<MentionFeedItem>>( resolve => {
doSomeXHRQuery( result => {
// console.log( result );
// -> [ '$name', '$surname', '$postal', ... ]
resolve( result );
} );
} );
}