Making bullet points in Draft.js
You can turn any text block to bullet points with RichUtils
of draft-js
. Here is how you can do it:
// button to turn text block to bullet points
<button onClick={this.toggleBulletPoints}>Bullet points</button>
toggleBulletPoints(){
this.setState({
RichUtils.toggleBlockType(
this.state.editorState,
'unordered-list-item'
)
})
}
Here is the complete example of to change inline styles and block types in draft-js
editor: https://github.com/facebook/draft-js/blob/master/examples/draft-0-10-0/rich/rich.html