react-mentions
react-mentions copied to clipboard
Add <MentionsOutput> component
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)
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 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
Yes that would be a very good Component to add.
@jfschwarz yew we need this component,thanks!
👍 would love this
+1
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.
+1 Please add this!
Would be useful ! ✌️
+1 Looking forward to this
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!