<commit_before>import Webiny from 'Webiny';

class Editor extends Webiny.Ui.FormComponent {
    constructor(props) {
        super(props);

        this.editor = null;
        this.options = null;

        this.bindMethods('getTextareaElement');
    }

    componentDidMount() {
        super.componentDidMount();

        $.trumbowyg.svgPath = Webiny.Assets('Core.Backend', 'images/trumbowyg.svg');

        const options = {
            btnsDef: {
                image: {
                    dropdown: ['insertImage', 'base64', 'noEmbed'],
                    ico: 'insertImage'
                }
            },
            btns: [
                ['viewHTML'],
                ['undo', 'redo'],
                ['formatting'],
                'btnGrp-design',
                ['link'],
                ['image'],
                'btnGrp-justify',
                'btnGrp-lists',
                ['foreColor', 'backColor'],
                ['preformatted'],
                ['horizontalRule'],
                ['fullscreen']
            ]
        };

        $(this.getTextareaElement()).trumbowyg(options).on('tbwchange', (content) => {
            this.props.valueLink.requestChange(content.currentTarget.value);
        });
    }

    componentWillReceiveProps(props) {
        if ($(this.getTextareaElement()).trumbowyg('html') !== props.valueLink.value && !_.isNull(props.valueLink.value)) {
            $(this.getTextareaElement()).trumbowyg('html', props.valueLink.value);
        }
    }

    shouldComponentUpdate() {
        return false;
    }

    getTextareaElement() {
        return $(ReactDOM.findDOMNode(this)).find('textarea')[0];
    }
}

Editor.defaultProps = {

    renderer() {
        return (
            <div>
                <textarea></textarea>
            </div>
        );
    }
};

export default Editor;<commit_msg>svg path can be changed through props<commit_after>import Webiny from 'Webiny';

class Editor extends Webiny.Ui.FormComponent {
    constructor(props) {
        super(props);

        this.editor = null;
        this.options = null;

        this.bindMethods('getTextareaElement');
    }

    componentDidMount() {
        super.componentDidMount();

        $.trumbowyg.svgPath = this.props.svgPath;

        const options = {
            btnsDef: {
                image: {
                    dropdown: ['insertImage', 'base64', 'noEmbed'],
                    ico: 'insertImage'
                }
            },
            btns: [
                ['viewHTML'],
                ['undo', 'redo'],
                ['formatting'],
                'btnGrp-design',
                ['link'],
                ['image'],
                'btnGrp-justify',
                'btnGrp-lists',
                ['foreColor', 'backColor'],
                ['preformatted'],
                ['horizontalRule'],
                ['fullscreen']
            ]
        };

        $(this.getTextareaElement()).trumbowyg(options).on('tbwchange', (content) => {
            this.props.valueLink.requestChange(content.currentTarget.value);
        });
    }

    componentWillReceiveProps(props) {
        if ($(this.getTextareaElement()).trumbowyg('html') !== props.valueLink.value && !_.isNull(props.valueLink.value)) {
            $(this.getTextareaElement()).trumbowyg('html', props.valueLink.value);
        }
    }

    shouldComponentUpdate() {
        return false;
    }

    getTextareaElement() {
        return $(ReactDOM.findDOMNode(this)).find('textarea')[0];
    }
}

Editor.defaultProps = {
    svgPath: Webiny.Assets('Core.Backend', 'images/trumbowyg.svg'),
    renderer() {
        return (
            <div>
                <textarea></textarea>
            </div>
        );
    }
};

export default Editor;
{'fraction_non_alphanumeric': 0.14323748668796593, 'fraction_numerical': 0.001597444089456869, 'mean_word_length': 1.6162952646239555, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3296613', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1011, 'n_words': 147}