Skip to content

Instantly share code, notes, and snippets.

@RaoHai
Created September 28, 2016 02:56
Show Gist options
  • Save RaoHai/de617ffe031fe8d1a04ac18ebbb2be8d to your computer and use it in GitHub Desktop.
Save RaoHai/de617ffe031fe8d1a04ac18ebbb2be8d to your computer and use it in GitHub Desktop.
import React from 'react';
import { Editor, EditorState } from 'draft-js';
import InlineStyles from '../InlineStyles';
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
customStyleMap={InlineStyles}
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