Reputation: 59
I gone through the documentation of draft-js-mention-plugin but couldn't figure a way to read all the mentions from the content. Is there a way can find all the mentions as array?. I need to store all the mentions seperately and send email.Your help is highly appreciated. I am using the example given in here
Upvotes: 3
Views: 1393
Reputation: 41
You can do like below :
const rawEditorContent = convertToRaw(this.state.editorState.getCurrentContent());
const entityMap = rawEditorContent.entityMap;
enter code here
Then loop through entityMap to get mentioned users:
Object.values(entityMap).map(entity => {
console.log(entity.data.mention);
});
Upvotes: 4