Media: Use infiniteScrolling global setting in js/media/controllers/featured-image.js and js/media/controllers/replace-image.js.

Follow-up to [52287] which added an undefined variable. The variable should have been the global `wp.media.view.settings.infiniteScrolling`. This commit brings that global setting into each of the functions and renames the variable using camelCase to comply with JS coding standards.

Follow-up to [52287].

Props SergeyBiryukov.
Fixes #53765.
Built from https://develop.svn.wordpress.org/trunk@52288


git-svn-id: http://core.svn.wordpress.org/trunk@51880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2021-11-30 19:07:00 +00:00
parent be55859f78
commit 308f814105
3 changed files with 7 additions and 5 deletions

View File

@ -4066,6 +4066,7 @@ FeaturedImage = Library.extend(/** @lends wp.media.controller.FeaturedImage.prot
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 ) {
@ -4075,7 +4076,7 @@ FeaturedImage = Library.extend(/** @lends wp.media.controller.FeaturedImage.prot
selection.reset( attachment ? [ attachment ] : [] );
if ( ! infinite_scrolling && library.hasMore() ) {
if ( ! infiniteScrolling && library.hasMore() ) {
library.more();
}
}
@ -7474,11 +7475,12 @@ ReplaceImage = Library.extend(/** @lends wp.media.controller.ReplaceImage.protot
updateSelection: function() {
var selection = this.get('selection'),
library = this.get('library'),
attachment = this.image.attachment;
attachment = this.image.attachment,
infiniteScrolling = wp.media.view.settings.infiniteScrolling;
selection.reset( attachment ? [ attachment ] : [] );
if ( ! infinite_scrolling && library.getTotalAttachments() == 0 && library.hasMore() ) {
if ( ! infiniteScrolling && library.getTotalAttachments() === 0 && library.hasMore() ) {
library.more();
}
}

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-52287';
$wp_version = '5.9-alpha-52288';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.