<commit_before>/**
 * Manages markdown content (saves an array)
 * @param collectionId
 * @param data
 * @param field - JSON data key
 */

function editMarkdownWithNoTitle (collectionId, data, field, idField) {
  var list = data[field];

  var dataTemplate;
  if (idField === 'note') {
    dataTemplate = {list: list, idField: idField, header: 'Notes'};
  } else if (idField === 'prerelease') {
    dataTemplate = {list: list, idField: idField, header: 'Pre-release access'};
  } else {
    dataTemplate = {list: list, idField: idField, header: 'Content'};
  }

  var html = templates.editorContentNoTitle(dataTemplate);
  $('#' + idField).replaceWith(html);
  // Load
  $('#content-edit').click(function() {
    var markdown = $('#one-markdown').val();
    var editedSectionValue = {title: 'Content', markdown: markdown};
    var saveContent = function(updatedContent) {
      data[field] = [updatedContent];
      saveMarkdownNoTitle(collectionId, data.uri, data, field, idField);
    };
    loadMarkdownEditor(editedSectionValue, saveContent, data);
  });

  // Delete
  $('#content-delete').click(function() {
    swal ({
      title: "Warning",
      text: "Are you sure you want to delete?",
      type: "warning",
      showCancelButton: true,
      confirmButtonText: "Delete",
      cancelButtonText: "Cancel",
      closeOnConfirm: false
    }, function(result){
      if (result === true) {
        $(this).parent().remove();
        data[field] = [];
        saveMarkdownNoTitle(collectionId, data.uri, data, field, idField);
        swal({
          title: "Deleted",
          text: "This " + idField + " has been deleted",<commit_msg>Fixed content not appearing when editing static pages.<commit_after>/**
 * Manages markdown content (saves an array)
 * @param collectionId
 * @param data
 * @param field - JSON data key
 */

function editMarkdownWithNoTitle (collectionId, data, field, idField) {
  var list = data[field];

  var dataTemplate;
  if (idField === 'note') {
    dataTemplate = {list: list, idField: idField, header: 'Notes'};
  } else if (idField === 'prerelease') {
    dataTemplate = {list: list, idField: idField, header: 'Pre-release access'};
  } else {
    dataTemplate = {list: list, idField: idField, header: 'Content'};
  }

  var html = templates.editorContentNoTitle(dataTemplate);
  $('#' + idField).replaceWith(html);
  // Load
  $('#content-edit').click(function() {
    var markdown = $('#content-markdown').val();
    var editedSectionValue = {title: 'Content', markdown: markdown};
    var saveContent = function(updatedContent) {
      data[field] = [updatedContent];
      saveMarkdownNoTitle(collectionId, data.uri, data, field, idField);
    };
    loadMarkdownEditor(editedSectionValue, saveContent, data);
  });

  // Delete
  $('#content-delete').click(function() {
    swal ({
      title: "Warning",
      text: "Are you sure you want to delete?",
      type: "warning",
      showCancelButton: true,
      confirmButtonText: "Delete",
      cancelButtonText: "Cancel",
      closeOnConfirm: false
    }, function(result){
      if (result === true) {
        $(this).parent().remove();
        data[field] = [];
        saveMarkdownNoTitle(collectionId, data.uri, data, field, idField);
        swal({
          title: "Deleted",
          text: "This " + idField + " has been deleted",
{'fraction_non_alphanumeric': 0.1504636553993419, 'fraction_numerical': 0.0, 'mean_word_length': 3.382699868938401, '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': '3138904', 'n_tokens_mistral': 1002, 'n_tokens_neox': 993, 'n_words': 262}