From 82bbec380a9e5973f67f0b998221878a0bd44197 Mon Sep 17 00:00:00 2001 From: mks11 Date: Tue, 18 Jul 2017 08:12:42 -0700 Subject: [PATCH] using newer 'ref' syntax Summary: *Before* submitting a pull request, please make sure the following is done... 1. Fork the repo and create your branch from `master`. 2. If you've added code that should be tested, add tests! 3. If you've changed APIs, update the documentation. 4. Ensure that: * The test suite passes (`npm test`) * Your code lints (`npm run lint`) and passes Flow (`npm run flow`) * You have followed the [testing guidelines](https://github.com/facebook/draft-js/wiki/Testing-for-Pull-Requests) 5. If you haven't already, complete the [CLA](https://code.facebook.com/cla). Please use the simple form below as a guideline for describing your pull request. Thanks for contributing to Draft.js! - **Summary** [...] **Test Plan** [...] Closes https://github.com/facebook/draft-js/pull/925 Differential Revision: D5442872 fbshipit-source-id: a99321f173a3cb64fe01b83360dbe7f30cbe8adc --- examples/draft-0-10-0/plaintext/plaintext.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/draft-0-10-0/plaintext/plaintext.html b/examples/draft-0-10-0/plaintext/plaintext.html index 3e8f0c4fb7..61275df021 100644 --- a/examples/draft-0-10-0/plaintext/plaintext.html +++ b/examples/draft-0-10-0/plaintext/plaintext.html @@ -35,12 +35,15 @@ constructor(props) { super(props); this.state = {editorState: EditorState.createEmpty()}; - - this.focus = () => this.refs.editor.focus(); this.onChange = (editorState) => this.setState({editorState}); this.logState = () => console.log(this.state.editorState.toJS()); + this.setDomEditorRef = ref => this.domEditor = ref; } - + + componentDidMount(){ + this.domEditor.focus() + } + render() { return (
@@ -49,7 +52,7 @@ editorState={this.state.editorState} onChange={this.onChange} placeholder="Enter some text..." - ref="editor" + ref={this.setDomEditorRef} />