如何在drafjs中将Json分配给编辑器?

问题描述 投票:0回答:1

我正在获取json对象,我想在其中将文本分配给draftjs编辑器但是当我尝试分配它时抛出错误

“ PageContainer.js:165未捕获的TypeError:draft_js__WEBPACK_IMPORTED_MODULE_1 __。EditorState.createFromText不是函数”

this.setState({
            editorState2: EditorState.createFromText(ContentState.createFromText("hi"))
         });

编辑器已经通过构造函数使用]创建了>

 constructor(props) {
        super(props);
        this.state = {
            editorState1: EditorState.createEmpty(),
            editorState2: EditorState.createEmpty(),
            persons: []

        };
    }
<< [

EditorState.createFromText
更改为
EditorState.createWithContent
this.setState({ editorState2: EditorState.createWithContent(ContentState.createFromText("hi")) });
ajax reactjs draftjs
1个回答
1
投票
© www.soinside.com 2019 - 2024. All rights reserved.