Created
June 27, 2018 10:16
-
-
Save levvsha/48d1b95ef75b49f593f3a342cd0de934 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updateData(data) { | |
const editorState = this.props.blockProps.getEditorState(); | |
const content = editorState.getCurrentContent(); | |
const selection = new SelectionState({ | |
anchorKey: this.props.block.key, | |
anchorOffset: 0, | |
focusKey: this.props.block.key, | |
focusOffset: this.props.block.getLength() | |
}); | |
const newContentState = Modifier.mergeBlockData(content, selection, data); | |
const newEditorState = EditorState.push(editorState, newContentState); | |
setTimeout(() => this.props.blockProps.setEditorState(newEditorState)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment