Changeset 29284
- Timestamp:
- 07/24/2014 07:59:18 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/media-editor.js
r28990 r29284 356 356 var collections = {}; 357 357 358 return _.extend( attributes,{358 return _.extend( { 359 359 coerce : wp.media.coerce, 360 360 /** … … 479 479 } 480 480 481 // Remove default attributes from the shortcode. 482 _.each( this.defaults, function( value, key ) { 483 attrs[ key ] = self.coerce( attrs, key ); 484 if ( value === attrs[ key ] ) { 485 delete attrs[ key ]; 486 } 487 }); 481 attrs = this.setDefaults( attrs ); 488 482 489 483 shortcode = new wp.shortcode({ … … 574 568 575 569 return this.frame; 576 } 577 }); 570 }, 571 572 setDefaults: function( attrs ) { 573 var self = this; 574 // Remove default attributes from the shortcode. 575 _.each( this.defaults, function( value, key ) { 576 attrs[ key ] = self.coerce( attrs, key ); 577 if ( value === attrs[ key ] ) { 578 delete attrs[ key ]; 579 } 580 }); 581 582 return attrs; 583 } 584 }, attributes ); 578 585 }; 579 586 580 wp.media. galleryDefaults = {587 wp.media._galleryDefaults = { 581 588 itemtag: 'dl', 582 589 icontag: 'dt', … … 591 598 592 599 if ( wp.media.view.settings.galleryDefaults ) { 593 _.extend( wp.media.galleryDefaults, wp.media.view.settings.galleryDefaults ); 600 wp.media.galleryDefaults = _.extend( {}, wp.media._galleryDefaults, wp.media.view.settings.galleryDefaults ); 601 } else { 602 wp.media.galleryDefaults = wp.media._galleryDefaults; 594 603 } 595 604 … … 598 607 type : 'image', 599 608 editTitle : wp.media.view.l10n.editGalleryTitle, 600 defaults : wp.media.galleryDefaults 609 defaults : wp.media.galleryDefaults, 610 611 setDefaults: function( attrs ) { 612 var self = this, changed = ! _.isEqual( wp.media.galleryDefaults, wp.media._galleryDefaults ); 613 _.each( this.defaults, function( value, key ) { 614 attrs[ key ] = self.coerce( attrs, key ); 615 if ( value === attrs[ key ] && ( ! changed || value === wp.media._galleryDefaults[ key ] ) ) { 616 delete attrs[ key ]; 617 } 618 } ); 619 return attrs; 620 } 601 621 }); 602 622
Note: See TracChangeset
for help on using the changeset viewer.