Projet

Général

Profil

Révision 98df731a

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media_ckeditor/js/media_ckeditor.format_form.js
12 12
}
13 13

  
14 14
/**
15
 * This overrides, and is mostly a copy of, a function from the following file:
16
 * media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js
15
 * This overrides the function of the same name from media/modules/media_wysiwyg/js/media_wysiwyg.format_form.js
16
 * It provides an implementation of that function that knows how to extract content from CKEditor instances.
17 17
 */
18
Drupal.media.formatForm.getOptions = function () {
19
  // Get all the values
20
  var ret = {};
21

  
22
  $.each($('#media-wysiwyg-format-form .fieldset-wrapper *').serializeArray(), function (i, field) {
23
    // When a field uses a WYSIWYG format, the value needs to be extracted.
24
    if (field.name.match(/\[format\]/i)) {
25
      // Only fields containing HTML need to be encoded.
26
      ret[field.name] = encodeURIComponent(field.value);
27
      field.name = field.name.replace(/\[format\]/i, '[value]');
28
      field.key  = 'edit-' + field.name.replace(/[_\[]/g, '-').replace(/[\]]/g, '');
29

  
30
      if (typeof CKEDITOR !== 'undefined') {
31
        if (CKEDITOR.instances[field.key]) {
32
          ret[field.name] = CKEDITOR.instances[field.key].getData();
33
          ret[field.name] = encodeURIComponent(ret[field.name]);
34
        }
35
      }
36
    }
37
    else {
38
      ret[field.name] = field.value;
39
    }
40
  });
41

  
42
  return ret;
43

  
18
Drupal.media.formatForm.getEditorContent = function(fieldKey) {
19
  if (typeof CKEDITOR !== 'undefined' && CKEDITOR.instances[fieldKey]) {
20
    return CKEDITOR.instances[fieldKey].getData();
21
  }
22
  else {
23
    // Default case => no CKEditor instance for this field.
24
    return null;
25
  }
44 26
};
45 27

  
46 28
})(jQuery);

Formats disponibles : Unified diff