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:
@@ -2182,14 +2182,20 @@
|
||||
* @param {object} 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;
|
||||
|
||||
// Set the Customizer setting; the callback takes care of rendering.
|
||||
this.setting( attachment.id );
|
||||
|
||||
|
||||
// Update the icon in-browser.
|
||||
$( 'link[sizes="32x32"]' ).attr( 'href', icon.url );
|
||||
},
|
||||
|
||||
4
wp-admin/js/customize-controls.min.js
vendored
4
wp-admin/js/customize-controls.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user