react-mentions icon indicating copy to clipboard operation
react-mentions copied to clipboard

LinkedIn lookalike hashtagging

Open kalemi19 opened this issue 4 years ago • 1 comments

I'm trying to replicate how hashtag suggestions appear on LinkedIn using react-mentions, but can't seem to get it to work, nor sure if it's even possible.

Screen Shot 2020-05-05 at 10 47 16 PM

Basically LinkedIn highlights the hashtag as you type, regardless if you choose one from the suggestions or not. You can also hit the backspace button without deleting the whole hashtag.

This is my setup based on some threads I read here.

<Mention
     trigger="#"
     markup="#__id__"
     regex={/#(\S+)/}
     data={[{
       id: 'covid19',
       display: 'covid19',
     },{
       id: 'covidsafe',
       display: 'covidsafe',
     }]}
     appendSpaceOnAdd
     style={{ color: colorPalette.secondary, zIndex: 1, position: 'relative' }}
     displayTransform={(id, display) => `#${display}`}
     renderSuggestion={suggestion => Mentions.renderHashtagsSuggestion(suggestion)}
   />
Screen Shot 2020-05-06 at 12 11 38 AM

Unfortunately the suggestions go away as soon as I type #c, it gets highlighted and if I press backspace, the whole thing gets deleted.

Screen Shot 2020-05-06 at 12 11 11 AM

I'm using v3.0.2

kalemi19 avatar May 05 '20 22:05 kalemi19

You can also hit the backspace button without deleting the whole hashtag.

I agree with this. Is there any way to achieve this kind of behavior?

alDoner avatar Jan 12 '21 17:01 alDoner