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

Add <MentionsOutput> component

Open Seoudi opened this issue 4 years ago • 10 comments

As I receive the value already from the DB Is there is a way to make the mentionsInput look like a paragraph ( To be disabled or readOnly)

Seoudi avatar Jun 25 '20 20:06 Seoudi

I guess you could by setting styles to make the textarea appear like a regular paragraph.

However, I would recommend using a regex to process the value and then render it in whatever way you like. We might offer a <MentionsOutput> component in the future to make this a bit more approachable to people who are not so comfortable with regular expressions. I imagine the API to look something like to this:

<MentionsOutput value={value}>
  <Mention
    trigger={triggerA}
    render={(id, display) => <span className="mention-a">{display}</span>}
  />
  <Mention 
    markup={markupB}
    regex={regexB}
    render={(id, display) => <span className="mention-b">{display}</span>}
  />
</MentionsOutput>

If anybody would like to contribute... I guess this would be a nice straightforward task. I'll actually just repurpose this issue. 😇

jfschwarz avatar Jun 26 '20 06:06 jfschwarz

@jfschwarz Thank you so much I did it with regex and substituted the matches with link to the mentions Ids and added that to a paragraph
image

Yes that would be a very good Component to add.

Seoudi avatar Jun 27 '20 11:06 Seoudi

@jfschwarz yew we need this component,thanks!

CrytisMT avatar Jan 07 '21 02:01 CrytisMT

👍 would love this

oskarmcd avatar Apr 30 '21 10:04 oskarmcd

+1

udonmai avatar May 13 '21 04:05 udonmai

At the very least you could start to display the text if we had access to some of the utils.

I assume that this would display something that looks ok:

getPlainText("Hello @[John](4T4PTBrxWFqSKS2jy) how are you doing?") -> Hello John how are you doing?

No highlight, but at least you don't have to rewrite that same function.

Floriferous avatar Jun 10 '21 16:06 Floriferous

+1 Please add this!

TechStudent10 avatar Aug 04 '21 17:08 TechStudent10

Would be useful ! ✌️

marcdelalonde avatar Feb 09 '22 21:02 marcdelalonde

+1 Looking forward to this

MadhukarRagaji avatar Feb 23 '22 07:02 MadhukarRagaji

I wonder why this was not integrated in first place, because it is obvious that people want to display the data that has been entered, no?

That being said, I would also love to see a standard for this, no matter how it looks.

Thanks to everybody involved!

baba43 avatar Apr 10 '22 09:04 baba43