import React, {Component} from 'react';
import { Editor } from '@tinymce/tinymce-react';

class AddComment extends Component {
    handleEditorChange = (e) => {
        const comment = e.target.getContent();
        this.props.onEditorChange(comment);
    }

    render() {

        return (
            <div>
                <Editor
                   init={{
                     plugins: 'link textcolor lists colorpicker code',
                     toolbar: 'undo redo | styleselect | bold italic underline forecolor fontsizeselect | link | alignleft aligncenter alignright | numlist bullist | outdent indent | code'
                   }}
                   onChange={this.handleEditorChange}
                 />
            </div>
        );
    }
}

export default AddComment;
