text: import React from 'react';
  import ReactDOM from 'react-dom';
  import {Editor, EditorState, RichUtils} from 'draft-js';
  
  export class MyEditor extends React.Component {
    constructor(props) {
      super(props);
      this.state = {editorState: EditorState.createEmpty()};
      this.onChange = (editorState) => this.setState({editorState});
      this.handleKeyCommand = this.handleKeyCommand.bind(this);
    }
    handleKeyCommand(command) {
      const newState = RichUtils.handleKeyCommand(this.state.editorState, command);
      if (newState) {
        this.onChange(newState);
        return true;
      }
      return false;
    }
    _onBoldClick() {
    this.onChange(RichUtils.toggleInlineStyle(this.state.editorState, 'BOLD'));
  }
    render() {
      console.log(this.state.editorState)
      return (
        <div>
          <button onClick={this._onBoldClick.bind(this)}>Bold</button>
          <Editor
            editorState={this.state.editorState}
            handleKeyCommand={this.handleKeyCommand}
            onChange={this.onChange}
          />
        </div>
      );
    }
  }
  