Projet

Général

Profil

Paste
Télécharger (795 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / media_ckeditor / js / media_ckeditor.format_form.js @ 98df731a

1
/**
2
 * @file
3
 * Overrides of some functions in media and media_wysiwyg javascript.
4
 */
5

    
6
(function ($) {
7

    
8
// Sanity check, because javascript errors are bad.
9
if (typeof Drupal.media === 'undefined' ||
10
    typeof Drupal.media.formatForm === 'undefined') {
11
  return;
12
}
13

    
14
/**
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
 */
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
  }
26
};
27

    
28
})(jQuery);