Search code examples
reactjsdraftjsreact-draft-wysiwyg

onSuggestionStateChange in react-draft-wysiwyg not working


I have written below Editor block and onSuggestionStateChange calling function which filter the text as per suggestion it was working as expected but now it is not working do any one have idea is there any changes in this parameter ?

      <Editor 
      mention={{
        separator: ' ',
        trigger: '@',
        environment:'',
        Category:"",
        suggestions: this.state.suggestionsState,
      }}
      enableurl={{separator: '', trigger: 'https://',}}
      enablenonsecureurl={{separator: '', trigger: 'http://',}}
      enablewwwurl={{separator: '', trigger: 'www.',}}
      tabIndex={3}
      ref={this.setEditor}
      onSuggestionStateChange={this.onSuggestionStateChange}
      editorRef={setEditorReference} onFocus={this.hidePlaceHolder.bind(this)} onBlur={this.showPlaceHolder.bind(this)} toolbarHidden editorState={this.state.editorState} toolbarClassName="toolbarClassName"
      wrapperClassName="wrapperClassName form-control contribute-text-area" editorClassName="editorClassName" placeholder="" onEditorStateChange={this.contributionTextChange}/>

Solution

  • There isn't any onSuggestionStateChange in Editor component. Please go through this documentation. You'll find onEditorStateChange, onContentStateChange or onChange props that can be used to trigger when editor state changes.

    Hope this will be helpful.