<commit_before>import React from 'react';
import ReactDOM from 'react-dom';

import ControlsArea   from './ControlsArea';

export default class TextArea extends React.Component {

  constructor(props) {
    super(props);
    let text = (props.data === null) ? "" : JSON.stringify(props.data)
    this.state = {
      text: text
    };
    // bind React.Component for this
    this.onChange = this.onChange.bind(this);
    this.onDrop = this.onDrop.bind(this);
    this.clearText = this.clearText.bind(this);
  }

  updateData(text) {
    this.setState({text: text});
    try {
      let data = JSON.parse(text);
      this.props.updateData(data);
    } catch(e) {
      //console.log(e);
      this.props.updateData(null);
    }
  }

  componentDidMount() {
    // Refresh
    setInterval((() => {
      let text = this.refs.jsonText.value;
      this.updateData(text);
    }).bind(this), 3000);
  }

  onChange(event) {
    this.setState({text: event.target.value});
  }

  onDrop(event) {
    event.stopPropagation();
    event.preventDefault();
    if (event.dataTransfer.files.length > 0) {
      var file = event.dataTransfer.files[0];
      var reader = new FileReader();
      reader.onload = (() => {
        this.updateData(reader.result);
      }).bind(this);
      reader.readAsText(file);
    }
  }

  clearText() {
    this.updateData('');
  }

	render() {
		return (
      <div>
        <textarea id="json-text"
                  placeholder="Write JSON code here."
                  value={this.state.text}
                  onChange={this.onChange}
                  onDrop={this.onDrop}
                  ref="jsonText"></textarea>
        <ControlsArea text={this.state.text}
                      clearText={this.clearText} />
      </div>
		);
	}
}<commit_msg>Updated the placeholder text.<commit_after>import React from 'react';
import ReactDOM from 'react-dom';

import ControlsArea   from './ControlsArea';

export default class TextArea extends React.Component {

  constructor(props) {
    super(props);
    let text = (props.data === null) ? "" : JSON.stringify(props.data)
    this.state = {
      text: text
    };
    // bind React.Component for this
    this.onChange = this.onChange.bind(this);
    this.onDrop = this.onDrop.bind(this);
    this.clearText = this.clearText.bind(this);
  }

  updateData(text) {
    this.setState({text: text});
    try {
      let data = JSON.parse(text);
      this.props.updateData(data);
    } catch(e) {
      //console.log(e);
      this.props.updateData(null);
    }
  }

  componentDidMount() {
    // Refresh
    setInterval((() => {
      let text = this.refs.jsonText.value;
      this.updateData(text);
    }).bind(this), 3000);
  }

  onChange(event) {
    this.setState({text: event.target.value});
  }

  onDrop(event) {
    event.stopPropagation();
    event.preventDefault();
    if (event.dataTransfer.files.length > 0) {
      var file = event.dataTransfer.files[0];
      var reader = new FileReader();
      reader.onload = (() => {
        this.updateData(reader.result);
      }).bind(this);
      reader.readAsText(file);
    }
  }

  clearText() {
    this.updateData('');
  }

	render() {
		return (
      <div>
        <textarea id="json-text"
                  placeholder="Write JSON code or drop a JSON file here."
                  value={this.state.text}
                  onChange={this.onChange}
                  onDrop={this.onDrop}
                  ref="jsonText"></textarea>
        <ControlsArea text={this.state.text}
                      clearText={this.clearText} />
      </div>
		);
	}
}
{'fraction_non_alphanumeric': 0.14877641824249166, 'fraction_numerical': 0.0033370411568409346, 'mean_word_length': 2.217352415026834, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '5169583', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1111, 'n_words': 202}