【问题标题】:Highlight words in draft-js NPM在 Draft-js NPM 中突出显示单词
【发布时间】: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


    【解决方案1】:

    【讨论】:

    • 棒极了,但是可以匹配多个hello吗?
    猜你喜欢
    • 2014-08-07
    • 2012-11-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-25
    • 1970-01-01
    • 2012-07-27
    • 2013-06-29
    相关资源
    最近更新 更多