Changeset 22760
- Timestamp:
- 11/21/2012 02:20:01 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/media-upload.js
r22758 r22760 149 149 props = _.defaults( props || {}, { 150 150 align: getUserSetting( 'align', 'none' ), 151 size: getUserSetting( 'imgsize', 'medium' ) 151 size: getUserSetting( 'imgsize', 'medium' ), 152 url: '' 152 153 }); 153 154 … … 169 170 } 170 171 171 img.width = size.width; 172 img.height = size.height; 173 img.src = size.url; 172 img.src = props.url; 173 _.extend( img, _.pick( props, 'width', 'height', 'alt' ) ); 174 174 175 175 // Only assign the align class to the image if we're not printing … … 205 205 // Generate the caption shortcode. 206 206 if ( props.caption ) { 207 shortcode = { 208 width: img.width 209 }; 207 shortcode = {}; 208 209 if ( img.width ) 210 shortcode.width = img.width; 210 211 211 212 if ( props.captionId ) … … 409 410 410 411 workflow.get('embed').on( 'select', function() { 411 var embed = workflow.state().toJSON(), 412 options; 412 var embed = workflow.state().toJSON(); 413 414 embed.url = embed.url || ''; 413 415 414 416 if ( 'link' === embed.type ) { 415 this.insert( wp.html.string({ 416 tag: 'a', 417 content: embed.title || embed.url, 418 attrs: { 419 href: embed.url 420 } 421 }) ); 417 _.defaults( embed, { 418 title: embed.url, 419 linkUrl: embed.url 420 }); 421 422 this.insert( wp.media.string.link( embed ) ); 422 423 423 424 } else if ( 'image' === embed.type ) { 424 425 _.defaults( embed, { 426 title: embed.url, 427 linkUrl: '', 425 428 align: 'none', 426 url: '',427 alt: '',428 linkUrl: '',429 429 link: 'none' 430 430 }); 431 431 432 options = { 433 single: true, 434 tag: 'img', 435 attrs: { 436 'class': 'align' + embed.align, 437 src: embed.url, 438 alt: embed.alt 439 } 440 }; 441 442 if ( 'custom' === embed.link || 'file' === embed.link ) { 443 options = { 444 tag: 'a', 445 content: options, 446 attrs: { 447 href: 'custom' === embed.link ? embed.linkUrl : embed.url 448 } 449 }; 450 } 451 452 this.insert( wp.html.string( options ) ); 432 if ( 'none' === embed.link ) 433 embed.linkUrl = ''; 434 else if ( 'file' === embed.link ) 435 embed.linkUrl = embed.url; 436 437 this.insert( wp.media.string.image( embed ) ); 453 438 } 454 439 }, this );
Note: See TracChangeset
for help on using the changeset viewer.