Skip to content

Instantly share code, notes, and snippets.

@RaoHai
Last active September 28, 2016 02:45
Show Gist options
  • Save RaoHai/d159683eaa7e074ff30a270405922546 to your computer and use it in GitHub Desktop.
Save RaoHai/d159683eaa7e074ff30a270405922546 to your computer and use it in GitHub Desktop.
import React from 'react';
import { Editor, EditorState } from 'draft-js';
export default class EditorCore extends React.Component {
constructor(props) {
super(props);
this.state = { editorState: EditorState.createEmpty() };
this.onChange = this._onChange.bind(this);
}
_onChange(editorState) {
this.setState({ editorState });
}
render() {
const { editorState } = this.state;
return (<div className="MediumEditor-root">
<Editor
placeholder="Tell your story..."
editorState={editorState}
onChange={this.onChange}
/>
</div>);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment