react-draft-wysiwyg icon indicating copy to clipboard operation
react-draft-wysiwyg copied to clipboard

Custom Mentions

Open yourgirlcodes opened this issue 5 years ago • 4 comments

Is there a way to incorporate the Draft-js plugins : draft-js-mention-with-custom-add-plugin as well as the plugin that is used for templating?? I need to have the mention render to the page as {{ mention }} instead of @mention, so that I can use templating. I would also like to add a tooltip to the {{ mention }}

I have tried to use a custom decorator but it does not work.

Help would be appreciated!

yourgirlcodes avatar Feb 06 '20 15:02 yourgirlcodes

I also would like to know if it's possible to customize the rendering of the mention suggestions.

vmc08 avatar Mar 31 '20 10:03 vmc08

Yeah, another +1 here too. The odd bit is there is that trigger parameter... which does if fact alter the initiator of the event. This suggests that there is indeed a selector being examined, although only the one most recent character. I'm looking through the source to attempt to locate it; if I can track it down, I'll mod an open a PR.

NerdyDeedsLLC avatar Apr 29 '20 21:04 NerdyDeedsLLC

@yourgirlcodes - So I've been digging through the code for the ability to alter the triggers on the mentions. This is not a fix, though in your specific case it may be adequate. In the Editor component declaration, try this:

    separator: '{',
    trigger: '{',

I'm still going to mod it (in my case, I need <<## as the initiating string), but if you're simply after {{mention}} that's a fast and dirty way to tackle it.

NerdyDeedsLLC avatar Apr 29 '20 22:04 NerdyDeedsLLC

is there any way to customize the mention dropdown as I need to show user image , name email properly and should have flexibilty to style accordingly

zakriayounas avatar Dec 27 '24 05:12 zakriayounas