<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>mentions Composer Plugin</title><link>https://community.telligent.com/community/11/w/api-documentation/67135/mentions-composer-plugin</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>mentions Composer Plugin</title><link>https://community.telligent.com/community/11/w/api-documentation/67135/mentions-composer-plugin</link><pubDate>Tue, 19 Nov 2019 20:27:48 GMT</pubDate><guid isPermaLink="false">13eed690-2233-4dcd-a4e1-3d9b873017de</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67135/mentions-composer-plugin#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/19/2019 20:27:48&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;&lt;a id="Mention_Composer_Plugin" name="Mention_Composer_Plugin"&gt;&lt;/a&gt;Mention Composer Plugin&lt;/h3&gt;
&lt;p&gt;[[evolutionComposer jQuery Plugin|Composer]] plugin which adds @mention support.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Usage" name="Usage"&gt;&lt;/a&gt;Usage&lt;/h3&gt;
&lt;p&gt;Like other [[evolutionComposer jQuery Plugin|Composer]] plugins, it can be declared in the list of plugins when instantiating a composer&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$(&amp;#39;textarea.selector&amp;#39;).evolutionComposer({
    plugins: ['mentions']
    // extra options supported by the mentions plugin
});
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;&lt;a id="Options" name="Options"&gt;&lt;/a&gt;Options&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;onMentionableList&lt;/code&gt;: function which is called to asynchronously provide suggested type-ahead results during @mention composition
&lt;ul&gt;
&lt;li&gt;
parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query&lt;/code&gt;: string query&lt;/li&gt;
&lt;li&gt;&lt;code&gt;complete&lt;/code&gt;: function to be called to pass the results back to the composer. Should be passed an array of objects with &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;token&lt;/code&gt; keys on each.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;default: ** This is automatically supplied globally by Evolution, but can be overridden**&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;onListContent&lt;/code&gt;: function which is called to transform a set of contentId and contentTypeIds to their HTML Names
&lt;ul&gt;
&lt;li&gt;
parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;contentIdsAndTypes&lt;/code&gt;: array of objects, each containing a contentId and contentTypeId string&lt;/li&gt;
&lt;li&gt;&lt;code&gt;complete&lt;/code&gt;: function to be called to pass the results back to the composer. Should be passed an array of objects with contentId, contentTypeId, and htmlName.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;highlightClass&lt;/code&gt;: class name to apply to the @mention to differentiate it from surrounding text.
&lt;ul&gt;
&lt;li&gt;default: &lt;code&gt;&amp;#39;composer-mentionable-mention-highlight&amp;#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;a id="Default_onMentionableList_implementation" name="Default_onMentionableList_implementation"&gt;&lt;/a&gt;Default onMentionableList implementation:&lt;/h4&gt;
&lt;p&gt;This is automatically supplied globally by Evolution, but can be overridden:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;onListContent: function(contentIdsAndTypes, complete) {
    // gets a set of HtmlNames for a given set of content ids/type ids for the purpose
    // of re-showing a pre-exisitng mention token in text
    $.telligent.evolution.batch(function(){
        $.each(contentIdsAndTypes, function(i, content) {
            $.telligent.evolution.get({
                url: $.telligent.evolution.site.getBaseUrl() + &amp;#39;api.ashx/v2/genericcontent/{contentId}/{contentTypeId}.json&amp;#39;,
                data: {
                    contentId: content.contentId,
                    contentTypeId: content.contentTypeId
                }
            }).then(function(r){
                content.name = r.Content.HtmlName;
            });
        });
    }).then(function(){
        complete(contentIdsAndTypes);
    });
},
onMentionableList: function(query, complete) {
    $.telligent.evolution.get({
        url: $.telligent.evolution.site.getBaseUrl() + &amp;#39;api.ashx/v2/mentionables.json?IncludeFields=Token,PreviewHtml&amp;#39;,
        data: {
            QueryText: query,
            PageSize: 20
        },
        cache: false,
        dataType: &amp;#39;json&amp;#39;,
        success: function(response) {
            if(response.Mentionables &amp;amp;&amp;amp; response.Mentionables.length &amp;gt; 0) {
                var results = $.map(response.Mentionables, function(mentionable) {
                    return { name: mentionable.PreviewHtml, token: mentionable.Token };
                });
                complete(results);
            } else {
                complete(null);
            }
        }
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>