mirror of
git://develop.git.wordpress.org/
synced 2025-04-12 08:02:05 +02:00
Media: Fix selections in Media Library Featured Image modal on open.
In [50829] infinite scrolling was removed from the Media Library and modal which introduced unintended behavior for featured images where only the selected image shows when opening the library. This change reverts only the logic that caused this and applies a proper fix when opening the library. Props benitolopez, hellofromTonya, joedolson, peterwilsoncc, circlecube, danielbachhuber, PieWP, sabernhardt, szaqal21, dariak, sergeybiryukov. Fixes #53765. git-svn-id: https://develop.svn.wordpress.org/trunk@52384 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
954e9c153f
commit
0759d89e67
src/js/media/controllers
@ -106,9 +106,7 @@ FeaturedImage = Library.extend(/** @lends wp.media.controller.FeaturedImage.prot
|
||||
*/
|
||||
updateSelection: function() {
|
||||
var selection = this.get('selection'),
|
||||
library = this.get('library'),
|
||||
id = wp.media.view.settings.post.featuredImageId,
|
||||
infiniteScrolling = wp.media.view.settings.infiniteScrolling,
|
||||
attachment;
|
||||
|
||||
if ( '' !== id && -1 !== id ) {
|
||||
@ -117,10 +115,6 @@ FeaturedImage = Library.extend(/** @lends wp.media.controller.FeaturedImage.prot
|
||||
}
|
||||
|
||||
selection.reset( attachment ? [ attachment ] : [] );
|
||||
|
||||
if ( ! infiniteScrolling && library.hasMore() ) {
|
||||
library.more();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -90,24 +90,28 @@ ReplaceImage = Library.extend(/** @lends wp.media.controller.ReplaceImage.protot
|
||||
* @since 3.9.0
|
||||
*/
|
||||
activate: function() {
|
||||
this.updateSelection();
|
||||
this.frame.on( 'content:render:browse', this.updateSelection, this );
|
||||
|
||||
Library.prototype.activate.apply( this, arguments );
|
||||
},
|
||||
|
||||
/**
|
||||
* @since 5.9.0
|
||||
*/
|
||||
deactivate: function() {
|
||||
this.frame.off( 'content:render:browse', this.updateSelection, this );
|
||||
|
||||
Library.prototype.deactivate.apply( this, arguments );
|
||||
},
|
||||
|
||||
/**
|
||||
* @since 3.9.0
|
||||
*/
|
||||
updateSelection: function() {
|
||||
var selection = this.get('selection'),
|
||||
library = this.get('library'),
|
||||
attachment = this.image.attachment,
|
||||
infiniteScrolling = wp.media.view.settings.infiniteScrolling;
|
||||
attachment = this.image.attachment;
|
||||
|
||||
selection.reset( attachment ? [ attachment ] : [] );
|
||||
|
||||
if ( ! infiniteScrolling && library.getTotalAttachments() === 0 && library.hasMore() ) {
|
||||
library.more();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user