diff --git a/plugins/media/icons/media.png b/plugins/media/icons/media.png deleted file mode 100644 index 272871f..0000000 Binary files a/plugins/media/icons/media.png and /dev/null differ diff --git a/plugins/media/library.js b/plugins/media/library.js index a1f3337..eca4be8 100644 --- a/plugins/media/library.js +++ b/plugins/media/library.js @@ -49,6 +49,14 @@ attributes: formattedMedia.options }); + // Make sure title and alt get applied. + this.applyAttributes( + element, + mediaFile.fid, + formattedMedia.type, + formattedMedia.options + ); + // Use own wrapper element to be able to properly deal with selections. // Check prepareDataForWysiwygMode() in plugin.js for details. var wysiwygHTML = Drupal.media.filter.getWysiwygHTML(element); @@ -72,14 +80,9 @@ }, /** - * Forces custom attributes into the class field of the specified image. + * Applies attributes to the element. * - * Due to a bug in some versions of Firefox - * (http://forums.mozillazine.org/viewtopic.php?f=9&t=1991855), the - * custom attributes used to share information about the image are - * being stripped as the image markup is set into the rich text - * editor. Here we encode these attributes into the class field so - * the data survives. + * Title and alt attributes are applied to images. * * @param imgElement * The image @@ -90,25 +93,7 @@ * @param additional * Additional attributes to add to the image. */ - forceAttributesIntoClass: function (imgElement, fid, view_mode, additional) { - var wysiwyg = imgElement.attr('wysiwyg'); - if (wysiwyg) { - imgElement.addClass('attr__wysiwyg__' + wysiwyg); - } - var format = imgElement.attr('format'); - if (format) { - imgElement.addClass('attr__format__' + format); - } - var typeOf = imgElement.attr('typeof'); - if (typeOf) { - imgElement.addClass('attr__typeof__' + typeOf); - } - if (fid) { - imgElement.addClass('img__fid__' + fid); - } - if (view_mode) { - imgElement.addClass('img__view_mode__' + view_mode); - } + applyAttributes: function (imgElement, fid, view_mode, additional) { if (additional) { for (var name in additional) { if (additional.hasOwnProperty(name)) { @@ -119,9 +104,6 @@ case 'field_file_image_title_text[und][0][value]': imgElement.attr('title', additional[name]); break; - default: - imgElement.addClass('attr__' + name + '__' + additional[name]); - break; } } }