<commit_before>
module.exports = (model, dispatch) => {
  const root = document.createElement('div');

  if (model.channelOnEdit === null) {
    return root;
  }

  const c = model.channelOnEdit;
  const title = model.channels[c].title;

  const row = document.createElement('div');
  row.classList.add('row');
  row.classList.add('row-input');

  const form = document.createElement('form');

  const text = document.createElement('input');
  text.type = 'text';
  text.value = title;

  form.appendChild(text);

  const okBtn = document.createElement('button');
  okBtn.innerHTML = 'OK';
  okBtn.addEventListener('click', ev => {
    dispatch({
      type: 'EDIT_CHANNEL_TITLE',
      channel: c,
      title: text.value
    });
  });
  form.appendChild(okBtn);

  row.appendChild(form);
  root.appendChild(row);

  return root;
}
<commit_msg>Enable form submit by pressing enter<commit_after>
module.exports = (model, dispatch) => {
  const root = document.createElement('div');

  if (model.channelOnEdit === null) {
    return root;
  }

  const c = model.channelOnEdit;
  const title = model.channels[c].title;

  const row = document.createElement('div');
  row.classList.add('row');
  row.classList.add('row-input');

  const form = document.createElement('form');

  const text = document.createElement('input');
  text.type = 'text';
  text.value = title;
  form.appendChild(text);

  const okBtn = document.createElement('button');
  okBtn.type = 'button';
  okBtn.innerHTML = 'OK';
  form.appendChild(okBtn);

  row.appendChild(form);
  root.appendChild(row);

  // Events

  setTimeout(() => {
    text.focus();
  }, 200);

  form.addEventListener('submit', ev => {
    ev.preventDefault();
    dispatch({
      type: 'EDIT_CHANNEL_TITLE',
      channel: c,
      title: text.value
    });
  });

  okBtn.addEventListener('click', ev => {
    dispatch({
      type: 'EDIT_CHANNEL_TITLE',
      channel: c,
      title: text.value
    });
  });

  return root;
}

{'fraction_non_alphanumeric': 0.16050632911392404, 'fraction_numerical': 0.0015189873417721519, 'mean_word_length': 3.440449438202247, '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': '4732013', 'n_tokens_mistral': 632, 'n_tokens_neox': 610, 'n_words': 127}