<commit_before>#= require jquery-autosize

#we're using jquery autosize rather than jquery elastic since this works
#even if initialized before the element is in the DOM.

Backbone.Factlink ||= {}

insertTextInto = (currentText, cursorPos, text) ->
  textBefore = currentText.substring(0, cursorPos)
  textAfter = currentText.substring(cursorPos, currentText.length)

  if /\S$/.test(textBefore)
    text = ' ' + text
  if /^\S/.test(textAfter)
    text += ' '
  textBefore + text + textAfter

window.ReactTextArea = React.createClass
  displayName: 'ReactTextArea'

  getInitialState: ->
    text: ''

  componentDidMount: ->
    if @props.defaultValue?
      @updateText @props.defaultValue<commit_msg>Update state as early as possible<commit_after>#= require jquery-autosize

#we're using jquery autosize rather than jquery elastic since this works
#even if initialized before the element is in the DOM.

Backbone.Factlink ||= {}

insertTextInto = (currentText, cursorPos, text) ->
  textBefore = currentText.substring(0, cursorPos)
  textAfter = currentText.substring(cursorPos, currentText.length)

  if /\S$/.test(textBefore)
    text = ' ' + text
  if /^\S/.test(textAfter)
    text += ' '
  textBefore + text + textAfter

window.ReactTextArea = React.createClass
  displayName: 'ReactTextArea'

  getInitialState: ->
    text: ''

  componentWillMount: ->
    if @props.defaultValue?
      @updateText @props.defaultValue
{'fraction_non_alphanumeric': 0.11056682995101469, 'fraction_numerical': 0.0013995801259622112, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '4616589', 'n_tokens_mistral': 448, 'n_tokens_neox': 433, 'n_words': 116}