1
votes

I get a Html string from my API : "consigne": "<p>test</p>\n" and I want to display it on my editor.

My Editor is :

<Editor id="consigne" name= "consigne" editorState={consigne} value={draftToHtml(convertToRaw(consigne.getCurrentContent()))} onEditorStateChange={(consigne) => {this.setState({consigne})} localization={{ locale: 'fr' }}/>

I want to insert this consigne on my editor.

How I can push this consigne to my editor ?

1

1 Answers

1
votes

I find it by this :

  this.setState({ 
consigne:EditorState.createWithContent(ContentState.createFromBlockArray(convertFromHTML(plan.consigne))) 
    })