// Lib
import React, {Component} from 'react';
import Editor from '../../../component/EditorLoader';

export default class TextRich extends Component {

    constructor(props) {
        super(props);
        this.save = false;
    }

    componentWillUnmount() {
        if(this.props.rmSave) {
            this.props.rmSave(this.props.name);
        }
    }

    componentDidMount() {

    }

    _save = (evt) => {
        if(this.props.addSave) {
            this.props.addSave(this.props.name, evt);
        }
    };

    render() {
        return (
            <Editor html={'string' === typeof this.props.data ? this.props.data : true} saveHtml={this._save} onlyInline={this.props.onlyInline}/>
        );
    };
}