【发布时间】:2019-08-02 11:01:53
【问题描述】:
我有一个 Draft-js 富编辑器。我所需要的只是突出一些我可以在数组中提供给它的单词。 就像我可以向我的编辑器提供数组中的一些单词并基于某个类一样,它可以突出显示这些单词。
任何有关使用 Draft-js 执行相同操作的外部库的任何信息都会有所帮助
import Editor from 'draft-js-plugins-editor';
import { EditorState } from 'draft-js';
class Child extends React.Component {
constructor(props){
super(props);
this.state={
editorState:EditorState.createEmpty()
}
}
updateEditorState(editorState){
this.setState(
{editorState}
);
}
render() {
return (<div className="editor-container">
<Editor placeholder="Explore your way in..."
editorState={this.state.editorState}
onChange={this.updateEditorState.bind(this)}
/>
</div>);
}
}
【问题讨论】:
标签: reactjs draftjs draft-js-plugins