StevenDevooght / tinyMCE-mention

Mention/Autocomplete plugin for tinyMCE WYSIWYG editor.
http://stevendevooght.github.io/tinyMCE-mention/
220 stars 95 forks source link

update the render function to add the item index in argument. #62

Closed Kobee1203 closed 6 years ago

Kobee1203 commented 6 years ago

It can be useful when we want to set a different HTML according to the item position.

Here is an example to active the first item:

render: function(index, item) { return '<li' + (index == 0 ? ' class="active"' : '') + '>' + '' + item[this.options.queryBy] + '' + ''; }

Signed-off-by: Nicolas Dos Santos nicolas.dossantos@jalios.com

StevenDevooght commented 6 years ago

Hi @Kobee1203,

I'll be happy to merge this PR. Could you just put the index argument as second argument? render: function (item, index){}

That way we don' have a breaking change...

Kobee1203 commented 6 years ago

I made the changes. It's ok for you?

StevenDevooght commented 6 years ago

Thx