Site Icon: For preview fall back to `full` size URL when `thumbnail` size doesn't exist.
Prevents a JavaScript error for rare cases when cropping is skipped and the image is smaller than `thumbnail`. Props tyxla. Fixes #33417. Built from https://develop.svn.wordpress.org/trunk@34056 git-svn-id: http://core.svn.wordpress.org/trunk@34024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
09b159e494
commit
d6f26e4c7c
|
@ -2182,14 +2182,20 @@
|
||||||
* @param {object} attachment
|
* @param {object} attachment
|
||||||
*/
|
*/
|
||||||
setImageFromAttachment: function( attachment ) {
|
setImageFromAttachment: function( attachment ) {
|
||||||
var icon = typeof attachment.sizes['site_icon-32'] !== 'undefined' ? attachment.sizes['site_icon-32'] : attachment.sizes.thumbnail;
|
var sizes = [ 'site_icon-32', 'thumbnail', 'full' ],
|
||||||
|
icon;
|
||||||
|
|
||||||
|
_.each( sizes, function( size ) {
|
||||||
|
if ( ! icon && ! _.isUndefined ( attachment.sizes[ size ] ) ) {
|
||||||
|
icon = attachment.sizes[ size ];
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
this.params.attachment = attachment;
|
this.params.attachment = attachment;
|
||||||
|
|
||||||
// Set the Customizer setting; the callback takes care of rendering.
|
// Set the Customizer setting; the callback takes care of rendering.
|
||||||
this.setting( attachment.id );
|
this.setting( attachment.id );
|
||||||
|
|
||||||
|
|
||||||
// Update the icon in-browser.
|
// Update the icon in-browser.
|
||||||
$( 'link[sizes="32x32"]' ).attr( 'href', icon.url );
|
$( 'link[sizes="32x32"]' ).attr( 'href', icon.url );
|
||||||
},
|
},
|
||||||
|
|
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.4-alpha-34054';
|
$wp_version = '4.4-alpha-34056';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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