<commit_before>var React = require('react');
var utils = require('../lib/propUtils');
var assign = require('react/lib/Object.assign');

var Text = React.createClass({
  statics: {
    defaults: {
      fontSize: 18,
      fontFamily: 'Roboto',
      color: '#645839',
      fontWeight: 'normal',
      fontStyle: 'normal',
      textDecoration: 'none',
      textAlign: 'center',
      whiteSpace: 'nowrap',
      innerHTML: 'Hello world'
    }
  },

  getInitialState: function() {
    return {
      editing: false
    };
  },

  getDefaultProps: function () {
    return this.defaults;
  },

  render: function() {
    var style = {};
    var props = this.props;
    ['fontFamily', 'color', 'fontWeight', 'fontStyle', 'textDecoration', 'textAlign', 'whiteSpace']
      .forEach(prop => style[prop] = props[prop]);

    if (props.position) {
      style = assign(style, utils.propsToPosition(props));
    }

    var inputStyle = assign({}, style);
    inputStyle.background = "transparent";
    inputStyle.border = "2px dotted";
    inputStyle.borderWidth = "0 0 2px 0";

    var content = props.innerHTML;
    if (this.state.editing) {
      content = <input ref="input" style={inputStyle} onBlur={this.commitText} onChange={this.sendTextUpdate} value={content} />;
    }
    return <p style={style}>{content}</p>;
  },

  componentDidUpdate: function(prevProps, prevState) {
    if(this.refs.input) {
      this.refs.input.getDOMNode().focus();
    }
  },

  sendTextUpdate: function(evt) {
    var value = evt.target.value;
    this.props.updateText(value);
  },

  toggleEditing: function() {
    var toggled = !this.state.editing;
    this.setState({
      editing: toggled
    });
    return toggled;
  }
});

module.exports = Text;<commit_msg>fixed wonkiness on smaller width views<commit_after>var React = require('react');
var utils = require('../lib/propUtils');
var assign = require('react/lib/Object.assign');

var Text = React.createClass({
  statics: {
    defaults: {
      fontSize: 18,
      fontFamily: 'Roboto',
      color: '#645839',
      fontWeight: 'normal',
      fontStyle: 'normal',
      textDecoration: 'none',
      textAlign: 'center',
      whiteSpace: 'nowrap',
      innerHTML: 'Hello world'
    }
  },

  getInitialState: function() {
    return {
      editing: false
    };
  },

  getDefaultProps: function () {
    return this.defaults;
  },

  render: function() {
    var style = {};
    var props = this.props;
    ['fontFamily', 'color', 'fontWeight', 'fontStyle', 'textDecoration', 'textAlign', 'whiteSpace']
      .forEach(prop => style[prop] = props[prop]);

    if (props.position) {
      style = assign(style, utils.propsToPosition(props));
    }

    var inputStyle = assign({}, style);
    assign(inputStyle, {
      display: "inline-block",
      background: "transparent",
      border: "none",
      width: "100%",
      height: "100%"
    });

    var content = props.innerHTML;
    if (this.state.editing) {
      content = <input ref="input" style={inputStyle} onBlur={this.commitText} onChange={this.sendTextUpdate} value={content} />;
    }
    return <p ref="dims" style={style}>{content}</p>;
  },

  componentDidUpdate: function(prevProps, prevState) {
    if(this.refs.input) {
      this.refs.input.getDOMNode().focus();
    }
  },

  sendTextUpdate: function(evt) {
    var value = evt.target.value;
    this.props.updateText(value);
  },

  toggleEditing: function() {
    var toggled = !this.state.editing;
    this.setState({
      editing: toggled
    });
    return toggled;
  }
});

module.exports = Text;
{'fraction_non_alphanumeric': 0.15818893236444942, 'fraction_numerical': 0.007546115148127445, 'mean_word_length': 2.998882681564246, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '480470', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1143, 'n_words': 238}