Changeset 22482
- Timestamp:
- 11/09/2012 02:11:37 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-views.js
r22480 r22482 303 303 304 304 selection.on( 'selection:single selection:unsingle', this.sidebar, this ); 305 selection.on( 'add remove reset', this.refresh Toolbar, this );305 selection.on( 'add remove reset', this.refreshSelection, this ); 306 306 307 307 this._updateEmpty(); … … 364 364 }, 365 365 366 refresh Toolbar: function() {366 refreshSelection: function() { 367 367 this.frame.toolbar.view().refresh(); 368 this.trigger( 'refresh:selection', this, this.get('selection') ); 368 369 }, 369 370 … … 644 645 }); 645 646 646 this.bindHandlers();647 647 this.createSelection(); 648 648 this.createStates(); 649 this.bindHandlers(); 650 651 // Set the default state. 652 this.state( this.options.state ); 649 653 }, 650 654 … … 685 689 }, this ); 686 690 691 _.each(['library', 'upload'], function( id ) { 692 this.get( id ).on( 'refresh:selection', function( state, selection ) { 693 var sidebar = this.sidebar; 694 695 if ( ! selection.length ) 696 sidebar.mode('clear'); 697 else if ( selection.length === 1 ) 698 sidebar.mode('attachment-settings'); 699 else 700 sidebar.mode('settings'); 701 }, this ); 702 }, this ); 703 687 704 this.sidebar.on( 'gallery-settings', this.onSidebarGallerySettings, this ); 688 705 }, … … 706 723 multiple: this.options.multiple, 707 724 menu: 'main', 708 sidebar: 'attachment-settings',709 725 710 726 // Update user settings when users adjust the … … 773 789 }, batch ) ) 774 790 ]); 775 776 // Set the default state.777 this.state( options.state );778 791 }, 779 792
Note: See TracChangeset
for help on using the changeset viewer.