In Media Grid, don't immediately load full size images if the requested size passed to wp.media.view.Attachment.imageSize()
does not exist, look for other suitable sizes.
Fixes #30861. Built from https://develop.svn.wordpress.org/trunk@31039 git-svn-id: http://core.svn.wordpress.org/trunk@31020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a5cd4c0493
commit
e678f9d051
@ -5430,21 +5430,33 @@
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
imageSize: function( size ) {
|
imageSize: function( size ) {
|
||||||
var sizes = this.model.get('sizes');
|
var sizes = this.model.get('sizes'), matched = false;
|
||||||
|
|
||||||
size = size || 'medium';
|
size = size || 'medium';
|
||||||
|
|
||||||
// Use the provided image size if possible.
|
// Use the provided image size if possible.
|
||||||
if ( sizes && sizes[ size ] ) {
|
if ( sizes ) {
|
||||||
return _.clone( sizes[ size ] );
|
if ( sizes[ size ] ) {
|
||||||
} else {
|
matched = sizes[ size ];
|
||||||
return {
|
} else if ( sizes.large ) {
|
||||||
url: this.model.get('url'),
|
matched = sizes.large;
|
||||||
width: this.model.get('width'),
|
} else if ( sizes.thumbnail ) {
|
||||||
height: this.model.get('height'),
|
matched = sizes.thumbnail;
|
||||||
orientation: this.model.get('orientation')
|
} else if ( sizes.full ) {
|
||||||
};
|
matched = sizes.full;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( matched ) {
|
||||||
|
return _.clone( matched );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: this.model.get('url'),
|
||||||
|
width: this.model.get('width'),
|
||||||
|
height: this.model.get('height'),
|
||||||
|
orientation: this.model.get('orientation')
|
||||||
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @param {Object} event
|
* @param {Object} event
|
||||||
|
2
wp-includes/js/media-views.min.js
vendored
2
wp-includes/js/media-views.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-alpha-31038';
|
$wp_version = '4.2-alpha-31039';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user