Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private toggleBlockStyle: DraftStyleChangeHandler = ({ type: blockStyle, data }) => {
- const { content, onChange } = this.props;
- if (data) {
- const selection = content.getSelection();
- const nextContentState = Modifier.setBlockData(content.getCurrentContent(), selection, Map(data));
- const newEditorState = EditorState.push(content, nextContentState, 'change-block-data');
- return onChange(newEditorState, 'change-block-data');
- }
- onChange(
- RichUtils.toggleBlockType(
- content,
- blockStyle
- ),
- blockStyle
- );
- }
Add Comment
Please, Sign In to add comment