Make WordPress Core

Changeset 52167


Ignore:
Timestamp:
11/15/2021 08:53:08 PM (5 years ago)
Author:
joedolson
Message:

Media: Featured image modal loads only selected image.

Fix bug introduced in [50829] that caused media modal to only load the selected image. Executes .more() when loading the modal to ensure that the media collection is available.

Props benitolopez, hellofromTonya, peterwilsoncc, danielbachhuber, PieWP, sabernhardt, szaqal21.
Fixes #53765.

Location:
trunk/src/js/media/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/controllers/featured-image.js

    r43309 r52167  
    8888         */
    8989        activate: function() {
    90                 this.updateSelection();
    9190                this.frame.on( 'open', this.updateSelection, this );
    9291
     
    108107        updateSelection: function() {
    109108                var selection = this.get('selection'),
     109                        library = this.get('library'),
    110110                        id = wp.media.view.settings.post.featuredImageId,
    111111                        attachment;
     
    117117
    118118                selection.reset( attachment ? [ attachment ] : [] );
     119
     120                if ( library.hasMore() ) {
     121                        library.more();
     122                }
    119123        }
    120124});
  • trunk/src/js/media/controllers/replace-image.js

    r43309 r52167  
    100100        updateSelection: function() {
    101101                var selection = this.get('selection'),
     102                        library = this.get('library'),
    102103                        attachment = this.image.attachment;
    103104
    104105                selection.reset( attachment ? [ attachment ] : [] );
     106
     107                if ( library.hasMore() ) {
     108                        library.more();
     109                }
    105110        }
    106111});
Note: See TracChangeset for help on using the changeset viewer.