Ticket #18984: 18984.5.diff
File 18984.5.diff, 1.6 KB (added by , 12 years ago) |
---|
-
wp-includes/js/media-editor.js
9 9 // outputting the proper object format based on the 10 10 // attachment's type. 11 11 props: function( props, attachment ) { 12 var link, linkUrl, size, sizes ;12 var link, linkUrl, size, sizes, fallbacks; 13 13 14 // Final fallbacks run after all processing has been completed. 15 fallbacks = function( props ) { 16 // Generate alt fallbacks and strip tags. 17 if ( 'image' === props.type && ! props.alt ) { 18 props.alt = props.caption || props.title || ''; 19 props.alt = props.alt.replace( /<\/?[^>]+>/g, '' ); 20 } 21 22 return props; 23 }; 24 14 25 props = props ? _.clone( props ) : {}; 15 26 16 27 if ( attachment && attachment.type ) … … 27 38 28 39 // All attachment-specific settings follow. 29 40 if ( ! attachment ) 30 return props;41 return fallbacks( props ); 31 42 43 props.title = props.title || attachment.title; 44 32 45 link = props.link || getUserSetting( 'urlbutton', 'post' ); 33 46 if ( 'file' === link ) 34 47 linkUrl = attachment.url; … … 54 67 55 68 // Format properties for non-images. 56 69 } else { 57 _.extend( props, { 58 title: attachment.title || attachment.filename, 59 rel: 'attachment wp-att-' + attachment.id 60 }); 70 props.title = props.title || attachment.filename; 71 props.rel = props.rel || 'attachment wp-att-' + attachment.id; 61 72 } 62 73 63 return props;74 return fallbacks( props ); 64 75 }, 65 76 66 77 link: function( props, attachment ) {