我从我的API:"consigne": "<p>test</p>\n"获得了一个超文本标记语言字符串,我想在我的编辑器上显示它。
我的编辑是:
<Editor id="consigne" name= "consigne" editorState={consigne} value={draftToHtml(convertToRaw(consigne.getCurrentContent()))} onEditorStateChange={(consigne) => {this.setState({consigne})} localization={{ locale: 'fr' }}/>我想在我的编辑器上插入这个寄售文件。
我怎样才能把这个寄售推送给我的编辑?
发布于 2019-11-08 21:49:43
我是这样找到它的:
this.setState({
consigne:EditorState.createWithContent(ContentState.createFromBlockArray(convertFromHTML(plan.consigne)))
})发布于 2021-09-16 23:04:23
对于最新版本:
const blocks = convertFromHTML(plan.consigne);
this.setState({
consigne: EditorState.createWithContent(ContentState.createFromBlockArray(blocks.contentBlocks, blocks.entityMap))
})https://stackoverflow.com/questions/58729175
复制相似问题