{"size": 923, "ext": "js", "max_stars_repo_path": "src/views/Components/Custom/RichTextEditor2/RichTextEditor2.js", "max_stars_repo_name": "yaser-elbatal/Annat", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/views/Components/Custom/RichTextEditor2/RichTextEditor2.js", "max_issues_repo_name": "yaser-elbatal/Annat", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/views/Components/Custom/RichTextEditor2/RichTextEditor2.js", "max_forks_repo_name": "yaser-elbatal/Annat", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.075, "max_line_length": 73, "alphanum_fraction": 0.5406283857}
import React, { Component } from 'react';

import 'jodit';
import 'jodit/build/jodit.min.css';
import JoditEditor from "jodit-react";


export default class RichTextEditor2 extends Component {
    constructor(props) {
        super(props);
        this.state = {
            content: (this.props.text || 'content'),
        }
    }

    updateContent = (value) => {
        this.setState({ content: value })
        this.props.result(value)
    }

    /**
     * @property Jodit jodit instance of native Jodit
     */
    jodit;
    setRef = jodit => this.jodit = jodit;

    config = {
        readonly: false // all options from https://xdsoft.net/jodit/doc/
    }
    render() {
        return (
            <JoditEditor
                editorRef={this.setRef}
                value={this.state.content}
                config={this.config}
                onChange={this.updateContent}
            />
        );
    }
}