<commit_before><%= form_for @document || Document.new(user: current_user) do |f| %>
  <%= f.text_field :title, placeholder: 'Untitled document', value: f.object.title.presence || 'Untitled document', style: 'font-size: 150%' %>

  <%=
    f.text_area :body,
      class: 'materialize-textarea quill_container',
      placeholder: "Write as little or as much as you'd like! This field will expand as you write."
  %>
  <br />
  <div class="grey-text" style="text-align: right">Don't forget to save!</div>
  <%= f.submit 'Save changes', class: 'btn btn-primary right blue' %>
<% end %>

<div style="clear: both"></div>
<%= content_for :javascript do %>
  var defaults = {
        theme: 'snow',
        modules: {
            toolbar: [
                //[{ 'header': [1, 2, 3, false] }],
                //[{ 'color': [] }, { 'background': [] }],
                ['bold', 'italic', 'underline', 'strike', { 'script': 'sub'}, { 'script': 'super' }],
                ['blockquote', 'code-block'],
                [{ 'list': 'ordered'}, { 'list': 'bullet' }],
                [{ 'indent': '-1'}, { 'indent': '+1' }],
                ['clean']
            ]
        }
    };


  Quilljs.setDefaults(defaults);
<% end %><commit_msg>allow entering tabs into document editor<commit_after><%= form_for @document || Document.new(user: current_user) do |f| %>
  <%= f.text_field :title, placeholder: 'Untitled document', value: f.object.title.presence || 'Untitled document', style: 'font-size: 150%' %>

  <%=
    f.text_area :body,
      class: 'materialize-textarea quill_container',
      id: 'editor',
      placeholder: "Write as little or as much as you'd like! This field will expand as you write."
  %>
  <br />
  <div class="grey-text" style="text-align: right">Don't forget to save!</div>
  <%= f.submit 'Save changes', class: 'btn btn-primary right blue' %>
<% end %>

<div style="clear: both"></div>
<%= content_for :javascript do %>
  var defaults = {
        theme: 'snow',
        modules: {
            toolbar: [
                //[{ 'header': [1, 2, 3, false] }],
                //[{ 'color': [] }, { 'background': [] }],
                ['bold', 'italic', 'underline', 'strike', { 'script': 'sub'}, { 'script': 'super' }],
                ['blockquote', 'code-block'],
                [{ 'list': 'ordered'}, { 'list': 'bullet' }],
                [{ 'indent': '-1'}, { 'indent': '+1' }],
                ['clean']
            ]
        }
    };

  Quilljs.setDefaults(defaults);

  $(document).delegate('#editor', 'keydown', function(e) {
    var keyCode = e.keyCode || e.which;

    if (keyCode == 9) {
      e.preventDefault();
      var start = this.selectionStart;
      var end = this.selectionEnd;

      // set textarea value to: text before caret + tab + text after caret
      $(this).val($(this).val().substring(0, start)
                  + "\t"
                  + $(this).val().substring(end));

      // put caret at right position again
      this.selectionStart =
      this.selectionEnd = start + 1;
    }
  });

<% end %>
{'fraction_non_alphanumeric': 0.19416202033453592, 'fraction_numerical': 0.006231551328304362, 'mean_word_length': 2.3296943231441047, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '2210276', 'n_tokens_mistral': 1014, 'n_tokens_neox': 930, 'n_words': 245}