<commit_before>import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';

export const EditParagraph = React.createClass({
  mixins: [PureRenderMixin],
  handleSave: function() {
    this.props.saveParagraph(this.refs.edit.value, this.props.parent);
  },
  handleEnter: function(event) {
    if(!event.shiftKey && event.keyCode == 13) {
        this.handleSave();
        return false;
    }
    return true;
  },
  componentDidMount: function(){
    this.refs.add.focus();

    this.refs.edit.addEventListener('keypress', this.handleEnter);
  },
  componentWillUnmount: function() {
    this.refs.edit.addEventListener('keypress', this.handleEnter);
  },
  render: function() {

    return <div className="paragraph paragraph-edit">
        <p>
          <textarea ref="edit" name="edit" placeholder="Tell your story!" />
        </p>
        <div className="buttons">
          <button ref="add" onClick={() => this.handleSave()}><span>Add</span></button>
          <button onClick={() => this.props.hideCreateParagraph(this.props.parent)}><span>Cancel</span></button>
        </div>
      </div>;
  }
});<commit_msg>Focusing on the text area so you can go 100% keyboard<commit_after>import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';

export const EditParagraph = React.createClass({
  mixins: [PureRenderMixin],
  handleSave: function() {
    this.props.saveParagraph(this.refs.edit.value, this.props.parent);
  },
  handleEnter: function(event) {
    if(!event.shiftKey && event.keyCode == 13) {
        this.handleSave();
        return false;
    }
    return true;
  },
  componentDidMount: function(){
    this.refs.add.focus();
    this.refs.edit.focus();

    this.refs.edit.addEventListener('keypress', this.handleEnter);
  },
  componentWillUnmount: function() {
    this.refs.edit.addEventListener('keypress', this.handleEnter);
  },
  render: function() {

    return <div className="paragraph paragraph-edit">
        <p>
          <textarea ref="edit" name="edit" placeholder="Tell your story!" />
        </p>
        <div className="buttons">
          <button ref="add" onClick={() => this.handleSave()}><span>Add</span></button>
          <button onClick={() => this.props.hideCreateParagraph(this.props.parent)}><span>Cancel</span></button>
        </div>
      </div>;
  }
});
{'fraction_non_alphanumeric': 0.16258445945945946, 'fraction_numerical': 0.0029560810810810812, 'mean_word_length': 3.3951762523191094, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 37, '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': '5511824', 'n_tokens_mistral': 731, 'n_tokens_neox': 710, 'n_words': 135}