Media: When an image does not have all image sizes available, make sure we insert the requested size into the editor. props koopersmith. fixes #22693.
git-svn-id: https://develop.svn.wordpress.org/trunk@23008 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4073eb5ec2
commit
63aa98ed0c
@ -3745,7 +3745,7 @@
|
|||||||
update: function( key ) {
|
update: function( key ) {
|
||||||
var value = this.model.get( key ),
|
var value = this.model.get( key ),
|
||||||
$setting = this.$('[data-setting="' + key + '"]'),
|
$setting = this.$('[data-setting="' + key + '"]'),
|
||||||
$buttons;
|
$buttons, $value;
|
||||||
|
|
||||||
// Bail if we didn't find a matching setting.
|
// Bail if we didn't find a matching setting.
|
||||||
if ( ! $setting.length )
|
if ( ! $setting.length )
|
||||||
@ -3756,7 +3756,15 @@
|
|||||||
|
|
||||||
// Handle dropdowns.
|
// Handle dropdowns.
|
||||||
if ( $setting.is('select') ) {
|
if ( $setting.is('select') ) {
|
||||||
$setting.find('[value="' + value + '"]').attr( 'selected', true );
|
$value = $setting.find('[value="' + value + '"]');
|
||||||
|
|
||||||
|
if ( $value.length ) {
|
||||||
|
$value.attr( 'selected', true );
|
||||||
|
} else {
|
||||||
|
// If we can't find the desired value, record what *is* selected.
|
||||||
|
this.model.set( $setting.data('setting'), $setting.find('[selected]').val() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Handle button groups.
|
// Handle button groups.
|
||||||
} else if ( $setting.hasClass('button-group') ) {
|
} else if ( $setting.hasClass('button-group') ) {
|
||||||
|
@ -1825,10 +1825,10 @@ function wp_print_media_templates() {
|
|||||||
<#
|
<#
|
||||||
var size = data.sizes['<?php echo esc_js( $value ); ?>'];
|
var size = data.sizes['<?php echo esc_js( $value ); ?>'];
|
||||||
if ( size ) { #>
|
if ( size ) { #>
|
||||||
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'medium' ); ?>>
|
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
|
||||||
<?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }}
|
<?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }}
|
||||||
</option>
|
</option>
|
||||||
<# } #>>
|
<# } #>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user