【发布时间】:2018-11-13 17:50:13
【问题描述】:
编辑器正在启动,就好像它有空字符串一样!
我试过了:
EditorState.createWithContent(ContentState.createFromText('Hello'))
还有这个:
const html = '<p>Hey this <strong>editor</strong> rocks ????</p>';
const contentBlock = htmlToDraft(html);
if (contentBlock) {
const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
const editorState = EditorState.createWithContent(contentState);
this.state = {
editorState,
};
}
还有这个:
import htmlToDraft from 'html-to-draftjs'
htmlToDraft(text)
没有任何效果!
【问题讨论】:
标签: javascript reactjs editor draftjs