Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我浏览了 draft-js-mention-plugin 的文档,但找不到从内容中读取所有提及的方法。有没有办法可以找到所有提及的数组?我需要单独存储所有提及并发送电子邮件。非常感谢您的帮助。我正在使用此处给出的示例
你可以像下面这样:
const rawEditorContent = convertToRaw(this.state.editorState.getCurrentContent()); const entityMap = rawEditorContent.entityMap; enter code here
然后遍历 entityMap 以获取提及的用户:
Object.values(entityMap).map(entity => { console.log(entity.data.mention); });