<commit_before>var debug = require('debug')('page');
var inspect = require('object-inspect');
var request = require('superagent');
import React from 'react';
import PageTitle from './pagetitle';
import PageContent from './pagecontent';

var PageApp = React.createClass({
  propTypes: {
    title: React.PropTypes.string,
    content: React.PropTypes.string,
    pageId: React.PropTypes.string
  },
  getInitialState: function() {
    return {
      title: this.props.title,
      content: this.props.content
    }
  },
  submitPage: function() {
    var path = this.props.pageId !== undefined && this.props.pageId !== null ? `/pages/${this.props.pageId}` : "/pages/";

    debug('submit to %s %s', path, inspect(this.state, {colors: true}));
    request
      .put(path)
      .send({name: this.state.title, content: this.state.content})
      .end((err, res) => { debug('%s %s', err, res) });
  },
  handleContentChange: function (text) {
    this.setState({content: text}, function() {
      clearTimeout(this.timeout);
      this.timeout = setTimeout(this.submitPage, 500);<commit_msg>render empty row when content is null<commit_after>var debug = require('debug')('page');
var inspect = require('object-inspect');
var request = require('superagent');
import React from 'react';
import PageTitle from './pagetitle';
import PageContent from './pagecontent';

var PageApp = React.createClass({
  propTypes: {
    title: React.PropTypes.string,
    content: React.PropTypes.string,
    pageId: React.PropTypes.string
  },
  getInitialState: function() {
    return {
      title: this.props.title,
      content: this.props.content === null ? "" : this.props.content
    }
  },
  submitPage: function() {
    var path = this.props.pageId !== undefined && this.props.pageId !== null ? `/pages/${this.props.pageId}` : "/pages/";

    debug('submit to %s %s', path, inspect(this.state, {colors: true}));
    request
      .put(path)
      .send({name: this.state.title, content: this.state.content})
      .end((err, res) => { debug('%s %s', err, res) });
  },
  handleContentChange: function (text) {
    this.setState({content: text}, function() {
      clearTimeout(this.timeout);
      this.timeout = setTimeout(this.submitPage, 500);
{'fraction_non_alphanumeric': 0.1668903803131991, 'fraction_numerical': 0.0026845637583892616, 'mean_word_length': 3.6486486486486487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1166465', 'n_tokens_mistral': 689, 'n_tokens_neox': 688, 'n_words': 163}