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}
|
||||
*/
|
||||
imageSize: function( size ) {
|
||||
var sizes = this.model.get('sizes');
|
||||
var sizes = this.model.get('sizes'), matched = false;
|
||||
|
||||
size = size || 'medium';
|
||||
|
||||
// Use the provided image size if possible.
|
||||
if ( sizes && sizes[ size ] ) {
|
||||
return _.clone( sizes[ size ] );
|
||||
} else {
|
||||
if ( sizes ) {
|
||||
if ( sizes[ size ] ) {
|
||||
matched = sizes[ size ];
|
||||
} else if ( sizes.large ) {
|
||||
matched = sizes.large;
|
||||
} else if ( sizes.thumbnail ) {
|
||||
matched = sizes.thumbnail;
|
||||
} 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
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @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.
|
||||
|
|
Loading…
Reference in New Issue