<commit_before>function t2Editor(collectionId, data) {

  var newHighlights = [];
  var setActiveTab, getActiveTab;
  var timeoutId;

  $(".edit-accordion").on('accordionactivate', function(event, ui) {
    setActiveTab = $(".edit-accordion").accordion("option", "active");
    if (setActiveTab !== false) {
      Florence.globalVars.activeTab = setActiveTab;
    }
  });

  getActiveTab = Florence.globalVars.activeTab;
  accordion(getActiveTab);

  // Metadata load, edition and saving
  $("#title").on('input', function () {
    $(this).textareaAutoSize();
    data.description.title = $(this).val();
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });
  $("#summary").on('input', function () {
    $(this).textareaAutoSize();
    data.description.summary = $(this).val();
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });
  $("#keywordsTag").tagit({availableTags: data.description.keywords,
                        singleField: true,
                        allowSpaces: true,
                        singleFieldNode: $('#keywords')
  });
  $('#keywords').on('change', function () {
    data.description.keywords = $('#keywords').val().split(', ');
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });
  $("#metaDescription").on('input', function () {
    $(this).textareaAutoSize();
    data.description.metaDescription = $(this).val();
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });

  // Save
  var editNav = $('.edit-nav');
  editNav.off(); // remove any existing event handlers.

  editNav.on('click', '.btn-edit-save', function () {
    save();
    updateContent(collectionId, data.uri, JSON.stringify(data));
  });

  // completed to review
  editNav.on('click', '.btn-edit-save-and-submit-for-review', function () {
    save();
    saveAndCompleteContent(collectionId, data.uri, JSON.stringify(data));
  });

  // reviewed to approve
  editNav.on('click', '.btn-edit-save-and-submit-for-approval', function () {
    save();
    saveAndReviewContent(collectionId, data.uri, JSON.stringify(data));
  });

  function save() {
    // Highligths
    var orderHighlights = $("#sortable-highlights").sortable('toArray');
    $(orderHighlights).each(function (indexH, titleH) {
      var uri = data.items[parseInt(titleH)].uri;
      var safeUri = checkPathSlashes(uri);
      newHighlights[indexH] = {uri: safeUri};
    });
    data.highlightedLinks = newHighlights;
  }
}
<commit_msg>Change field name to save sortable<commit_after>function t2Editor(collectionId, data) {

  var newHighlights = [];
  var setActiveTab, getActiveTab;
  var timeoutId;

  $(".edit-accordion").on('accordionactivate', function(event, ui) {
    setActiveTab = $(".edit-accordion").accordion("option", "active");
    if (setActiveTab !== false) {
      Florence.globalVars.activeTab = setActiveTab;
    }
  });

  getActiveTab = Florence.globalVars.activeTab;
  accordion(getActiveTab);

  // Metadata load, edition and saving
  $("#title").on('input', function () {
    $(this).textareaAutoSize();
    data.description.title = $(this).val();
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });
  $("#summary").on('input', function () {
    $(this).textareaAutoSize();
    data.description.summary = $(this).val();
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });
  $("#keywordsTag").tagit({availableTags: data.description.keywords,
                        singleField: true,
                        allowSpaces: true,
                        singleFieldNode: $('#keywords')
  });
  $('#keywords').on('change', function () {
    data.description.keywords = $('#keywords').val().split(', ');
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });
  $("#metaDescription").on('input', function () {
    $(this).textareaAutoSize();
    data.description.metaDescription = $(this).val();
    clearTimeout(timeoutId); 
timeoutId = setTimeout(function () {
autoSaveMetadata(collectionId, data);
}, 3000);
  });

  // Save
  var editNav = $('.edit-nav');
  editNav.off(); // remove any existing event handlers.

  editNav.on('click', '.btn-edit-save', function () {
    save();
    updateContent(collectionId, data.uri, JSON.stringify(data));
  });

  // completed to review
  editNav.on('click', '.btn-edit-save-and-submit-for-review', function () {
    save();
    saveAndCompleteContent(collectionId, data.uri, JSON.stringify(data));
  });

  // reviewed to approve
  editNav.on('click', '.btn-edit-save-and-submit-for-approval', function () {
    save();
    saveAndReviewContent(collectionId, data.uri, JSON.stringify(data));
  });

  function save() {
    // Highligths
    var orderHighlights = $("#sortable-highlights").sortable('toArray');
    $(orderHighlights).each(function (indexH, titleH) {
      var uri = data.highlightedLinks[parseInt(titleH)].uri;
      var safeUri = checkPathSlashes(uri);
      newHighlights[indexH] = {uri: safeUri};
    });
    data.highlightedLinks = newHighlights;
  }
}

{'fraction_non_alphanumeric': 0.17559523809523808, 'fraction_numerical': 0.006324404761904762, 'mean_word_length': 3.775310834813499, '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': '3393384', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1596, 'n_words': 279}