<commit_before>import React, { PropTypes, Component } from 'react';
import ReactDOM from 'react-dom';

class CodePrompt extends Component {
  constructor(props) {
    super(props);

    // this.state = { code: 'function add2(num) {\n  return num + 2;\n};' };
  }

  static propTypes = {
    mode: PropTypes.string,
    content: PropTypes.string,
  };

  static defaultProps = {
    mode: 'javascript',
    code: 'function add2(num) {\n  return num + 2;\n};',
    puzzle: 'Error'
  };

  componentDidMount() {
    this.editor = ace.edit('codePrompt');
    this.editor.setShowPrintMargin(false);
    this.editor.setOptions({minLines: 25});
    this.editor.setOptions({maxLines: 50});
    this.editor.setOption("dragEnabled", false)
    this.editor.setTheme("ace/theme/twilight");
    this.editor.getSession().setMode("ace/mode/javascript");
    this.editor.setReadOnly(true);
  }

  componentDidUpdate() {
    this.editor.setValue(this.props.puzzle);
    this.editor.clearSelection();
    // console.log(editor.getSession().getValue());
  }

  render() {
    const style = {fontSize: '14px !important', border: '1px solid lightgray'};

    return React.DOM.div({
      id: 'codePrompt',
      style: style,
      className: 'col-md-6'
    });
  }
}

export default CodePrompt;<commit_msg>[add] adds code for disabling selection of text.  commented out for development purposes<commit_after>import React, { PropTypes, Component } from 'react';
import ReactDOM from 'react-dom';

class CodePrompt extends Component {
  constructor(props) {
    super(props);

    // this.state = { code: 'function add2(num) {\n  return num + 2;\n};' };
  }

  static propTypes = {
    mode: PropTypes.string,
    content: PropTypes.string,
  };

  static defaultProps = {
    mode: 'javascript',
    code: 'function add2(num) {\n  return num + 2;\n};',
    puzzle: 'Error'
  };

  componentDidMount() {
    this.editor = ace.edit('codePrompt');
    this.editor.setShowPrintMargin(false);
    this.editor.setOptions({minLines: 25});
    this.editor.setOptions({maxLines: 50});
    this.editor.setOption("dragEnabled", false)
    this.editor.setTheme("ace/theme/twilight");
    this.editor.getSession().setMode("ace/mode/javascript");
    this.editor.setReadOnly(true);

    // Disables Selection of Text to Prevent Copy/Paste
    // Comment out for development purposes
    // this.editor.on('changeSelection', function(e) {
    //     this.editor.selection.setSelectionRange({
    //         start: {
    //             row: 0,
    //             column: 0
    //         },
    //         end: {
    //             row: 0,
    //             column: 0
    //         }
    //     });
    // }.bind(this));
  }

  componentDidUpdate() {
    this.editor.setValue(this.props.puzzle);
    this.editor.clearSelection();
  }

  render() {
    const style = {fontSize: '14px !important', border: '1px solid lightgray'};

    return React.DOM.div({
      id: 'codePrompt',
      style: style,
      className: 'col-md-6'
    });
  }
}

export default CodePrompt;
{'fraction_non_alphanumeric': 0.15359261700725116, 'fraction_numerical': 0.00922874093605801, 'mean_word_length': 2.7376847290640396, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5144256', 'n_tokens_mistral': 981, 'n_tokens_neox': 954, 'n_words': 198}