Guest User

Untitled

a guest
Jun 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. export default class DraftEditor extends Component {
  2. constructor() {
  3. super();
  4.  
  5. this.state = {
  6. editorState: EditorState.createEmpty()
  7. };
  8.  
  9. this.onChange = (editorState) => {
  10. console.log('editorState ==>', editorState.toJS());
  11.  
  12. this.setState({ editorState });
  13. }
  14. }
  15.  
  16. render() {
  17. const {
  18. editorState
  19. } = this.state;
  20.  
  21. return (
  22. <div
  23. id="editor-container"
  24. className="c-editor-container js-editor-container"
  25. >
  26. <div className="editor">
  27. <Editor
  28. editorState={editorState}
  29. onChange={this.onChange}
  30. placeholder="Здесь можно печатать..."
  31. />
  32. </div>
  33. </div>
  34. );
  35. }
  36. }
Add Comment
Please, Sign In to add comment