<commit_before>import React from 'react';
import Router from 'react-router';
import {connect} from 'react-redux';
import {MarkdownEditor, MarkdownEditorContentStore} from 'react-markdown-editor'
import {Link} from 'react-router';
import {push} from 'react-router-redux';
import {Button, Glyphicon, ListGroupItem, ListGroup, Popover, OverlayTrigger, Form, FormControl, ControlLabel, FormGroup, Nav, NavItem,} from 'react-bootstrap';
import Utils from '../utils/utils.js';
import {notify} from 'react-notify-toast';

//https://github.com/reactjs/react-tutorial/blob/master/public/scripts/example.js

export class CommentForm extends React.Component
{
    constructor(props)
    {
        super(props);
        this.state = {
            content:'',
            contentType: "text/markdown",
            edited: false,
            editorModeOverride: false,
            disableButton: true
        };
        this.getEditorMode = this.getEditorMode.bind(this);
        this.handleSelect = this.handleSelect.bind(this);
        this.onSubmit = this.onSubmit.bind(this);
        this.onChange = this.onChange.bind(this);
    }

    onSubmit(event) {
        console.log("Submitting comment");
        event.preventDefault();
        console.log("Form content type --> " + this.props.contentType);
        this.props.dispatch({
            type: "commentsAddComment",
            content: this.state.content,
            postId: this.props.postId,
            contentType: "text/x-markdown"
        });
        this.setState({content: ''});
    }

    onChange(content) {
        this.setState({
            content: this.state.contentType === "text/markdown" ? content : content.target.value,
            edited: true,
            disableButton: this.isButtonDisabled()
        });
    }

    isButtonDisabled() {
        return !(this.state.content.length > 0);
    }

    render()
    {
        return (
            <div className = "comment-form">
                <h4>Write Some Comments</h4>
                <Form onSubmit={this.onSubmit}>
                        <MarkdownEditor id="content-markdown"
                            initialContent={this.state.content}
                            iconsSet="font-awesome"
                            onContentChange={this.onChange}/>
                        <Button className="comment-form-save" type="submit" disabled={this.state.disableButton}>
                            Comment
                        </Button>
                </Form>
            </div>
        );
    }
}

// export the connected class
function mapStateToProps(state, own_props) {

    return {
        postId: own_props.postId,
    }
}
export default connect(mapStateToProps)(CommentForm);
<commit_msg>hard coded content type will fix unicode format<commit_after>import React from 'react';
import Router from 'react-router';
import {connect} from 'react-redux';
import {MarkdownEditor, MarkdownEditorContentStore} from 'react-markdown-editor'
import {Link} from 'react-router';
import {push} from 'react-router-redux';
import {Button, Glyphicon, ListGroupItem, ListGroup, Popover, OverlayTrigger, Form, FormControl, ControlLabel, FormGroup, Nav, NavItem,} from 'react-bootstrap';
import Utils from '../utils/utils.js';
import {notify} from 'react-notify-toast';

//https://github.com/reactjs/react-tutorial/blob/master/public/scripts/example.js

export class CommentForm extends React.Component
{
    constructor(props)
    {
        super(props);
        this.state = {
            content:'',
            contentType: "text/markdown",
            edited: false,
            editorModeOverride: false,
            disableButton: true
        };
        this.onSubmit = this.onSubmit.bind(this);
        this.onChange = this.onChange.bind(this);
    }

    onSubmit(event) {
        console.log("Submitting comment");
        event.preventDefault();
        console.log("Form content type --> " + this.props.contentType);
        this.props.dispatch({
            type: "commentsAddComment",
            content: this.state.content,
            postId: this.props.postId,
            contentType: "text/x-markdown"
        });
        this.setState({content: ''});
    }

    onChange(content) {
        this.setState({
            content: this.state.contentType === "text/markdown" ? content : content.target.value,
            edited: true,
            disableButton: this.isButtonDisabled()
        });
    }

    isButtonDisabled() {
        return !(this.state.content.length > 0);
    }

    render()
    {
        return (
            <div className = "comment-form">
                <h4>Write Some Comments</h4>
                <Form onSubmit={this.onSubmit}>
                        <MarkdownEditor id="content-markdown"
                            initialContent={this.state.content}
                            iconsSet="font-awesome"
                            onContentChange={this.onChange}/>
                        <Button className="comment-form-save" type="submit" disabled={this.state.disableButton}>
                            Comment
                        </Button>
                </Form>
            </div>
        );
    }
}

// export the connected class
function mapStateToProps(state, own_props) {

    return {
        postId: own_props.postId,
    }
}
export default connect(mapStateToProps)(CommentForm);

{'fraction_non_alphanumeric': 0.11940298507462686, 'fraction_numerical': 0.001119402985074627, 'mean_word_length': 2.0634285714285716, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, 'https://': 2, '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': '7370189', 'n_tokens_mistral': 1456, 'n_tokens_neox': 1423, 'n_words': 289}