ivirabyan / jquery-mentions

Adds mentioning support to your text fields.
http://ivirabyan.github.io/jquery-mentions/
MIT License
114 stars 49 forks source link

Mention callback #24

Closed avdept closed 9 years ago

avdept commented 9 years ago

Is there any callback that fires after you select mentioned object? I want to modify its appearance in my textarea

ivirabyan commented 9 years ago

There is no such callback, and I can't imagine how it can be useful. Appearance of mentioned object can be modified through stylesheets. Can you provide more details on what exactly you want to modify, maybe it can be done in some other way.

avdept commented 9 years ago

Sure. For ex. i want use method setValue(value), to modify appearance in my textarea from <strong>Value</strong, to something like <span data-thing="Some Cool Stuff here">Value</span>

At the moment i simply went to plugin code and changed behavior of function mentionTpl to what i need. But changing source of plugin doesnt seem good idea for me though, so i've asked about callback that fires after user changed something from suggestion

ivirabyan commented 9 years ago

So, you're using contenteditable, not textarea. And you want to insert span tag instead of strong. And probably add some data attribute to it (which would always have the same value). I can make mentionTpl configurable, but it is still not clear for me why would one want to do this.

avdept commented 9 years ago

Yes. I'm using with contenteditable(imperavi - redactor js). I want this because i have redmine plugin, which parses text from redactor and does some actions. I might send pull request if i decide to add some flexibility to mentionTpl. Also i want to use sync method from my redactor js, when adding mention completed