Hashtag Composer Plugin
Composer plugin which adds hashtag support.
Usage
Like other Composer plugins, it can be declared in the list of plugins when instantiating a composer
$('textarea.selector').evolutionComposer({
plugins: ['hashtags']
// extra options supported by the hashtag plugin
});
Options
-
onTagList
: function which is called to asynchronously provide suggested type-ahead results during hashtag composition-
parameters:
query
: string querycomplete
: function to be called to pass the results back to the composer. Should be passed an array of objects withname
andtoken
keys on each.
- default: This is automatically supplied globally by Evolution, but can be overridden
-
parameters:
-
highlightClass
: class name to apply to the hashtag to differentiate it from surrounding text.- default:
'composer-hashtag-highlight'
- default:
Default onTagList implementation:
This is automatically supplied globally by Evolution, but can be overridden:
onTagList: function(query, complete) {
$.telligent.evolution.get({
url: $.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/hashtags.json?IncludeFields=Token,PreviewHtml',
data: {
QueryText: query,
PageSize: 5
},
cache: false,
dataType: 'json',
success: function(response) {
if(response.HashTags && response.HashTags.length > 0) {
var results = $.map(response.HashTags, function(tag) {
return { name: tag.PreviewHtml, token: tag.Token };
});
complete(results);
} else {
complete(null);
}
}
});
}