【发布时间】:2017-10-27 19:06:54
【问题描述】:
我有一个字符串数组,我想将它作为无序列表预先填充到 draft.js 编辑器中。 代码如下:
const content = ContentState.createFromText(input.join('*'), '*')
const editorState = EditorState.createWithContent(content)
this.setState({
editorState: RichUtils.toggleBlockType(editorState, 'unordered-list-item'
})
这只是为数组中的第一个条目创建了一个项目符号项,但其他项没有继承块样式。
有什么想法吗?
【问题讨论】:
标签: javascript reactjs draftjs