/* @flow */

import React, { Component } from 'react';
import { Editor } from '../../../src';
import draftToHtml from 'draftjs-to-html';
import Menu from '../Menu';
import styles from './styles.css';

export default class Demo1 extends Component {

  state: any = {
    editorContent: undefined,
  };

  _onEditorChange: Function = (editorContent) => {
    this.setState({
      editorContent,
    });
  };

  render() {
    const { editorContent } = this.state;
    return (
      <div className={styles.demo4_root}>
        <Menu />
        <div className={styles.demo4_label}>
          Playground for react wysiwyg editors, inline and list styles in dropdown.
        </div>
        <div className={styles.demo4_editorWrapper}>
          <Editor
            toolbarClassName={styles.demo4_toolbar}
            wrapperClassName={styles.demo4_wrapper}
            editorClassName={styles.demo4_editor}
            onChange={this._onEditorChange}
            toolbarAlwaysVisible
            inlineControlInDropdown
            listControlInDropdown
          />
        </div>
        <textarea
          className={styles.demo4_content}
          value={draftToHtml(editorContent)}
        >
        </textarea>
      </div>
    );
  }
}
