diff --git a/README.md b/README.md index b38a4d1086..8e125cba8b 100644 --- a/README.md +++ b/README.md @@ -49,14 +49,40 @@ class MyEditor extends React.Component { super(props); this.state = {editorState: EditorState.createEmpty()}; this.onChange = (editorState) => this.setState({editorState}); + this.setEditor = (editor) => { + this.editor = editor; + }; + this.focusEditor = () => { + if (this.editor) { + this.editor.focus(); + } + }; } + + componentDidMount() { + this.focusEditor(); + } + render() { return ( - +
+ +
); } } +const styles = { + editor: { + border: '1px solid gray', + height: '6em' + } +}; + ReactDOM.render( , document.getElementById('container')