Changeset 22937
- Timestamp:
- 11/30/2012 01:38:41 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-editor.js
r22927 r22937 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 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 }; 13 24 14 25 props = props ? _.clone( props ) : {}; … … 28 39 // All attachment-specific settings follow. 29 40 if ( ! attachment ) 30 return props; 41 return fallbacks( props ); 42 43 props.title = props.title || attachment.title; 31 44 32 45 link = props.link || getUserSetting( 'urlbutton', 'post' ); … … 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 }); 61 } 62 63 return props; 70 props.title = props.title || attachment.filename; 71 props.rel = props.rel || 'attachment wp-att-' + attachment.id; 72 } 73 74 return fallbacks( props ); 64 75 }, 65 76
Note: See TracChangeset
for help on using the changeset viewer.