Mention plugin

Basic usage

This plugin allows to mention an user from a source list.

Read Mention plugin documentation

Check this out, there are lot of guys in the mention dropdown!

The code


$('#editor')
.trumbowyg({
    btns: [
        ['mention']
    ],
    plugins: {
        mention: {
            source: [
                {login: 'jdoe', name: 'John Doe (The Jean-Claude Van Damme\'s intern)'},
                {login: 'lgaga', name: 'Lady Gaga'},
                {login: 'jcvd', name: 'Jean-Claude Van Damme'},
                {login: 'nminaj', name: 'Nicki Minaj'},
                {login: 'mshinoda', name: 'Mike Shinoda'},
                {login: 'epiaf', name: 'Edith Piaf'},
                {login: 'kwest', name: 'Kanye West'},
                {login: 'jbalasko', name: 'Josiane Balasko'},
                {login: 'jcesar', name: 'Julius Cesarius'},
                {login: 'mlisa', name: 'Mona Lisa'},
                {login: 'mjackson', name: 'Mickael Jackson'},
                {login: 'fflament', name: 'Flavie Flament'},
            ],
            formatDropdownItem: function (item) {
                return item.name + ' (@' + item.login + ')';
            }
        }
    }
});
            

Setup

In head tag


            

At the end of body


<!-- Import jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-3.3.1.min.js"><\/script>')</script>