mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 18:01:42 +01:00
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: http://core.svn.wordpress.org/trunk@23008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
30cf064068
commit
156c5fef0f
@ -3745,7 +3745,7 @@
|
||||
update: function( key ) {
|
||||
var value = this.model.get( key ),
|
||||
$setting = this.$('[data-setting="' + key + '"]'),
|
||||
$buttons;
|
||||
$buttons, $value;
|
||||
|
||||
// Bail if we didn't find a matching setting.
|
||||
if ( ! $setting.length )
|
||||
@ -3756,7 +3756,15 @@
|
||||
|
||||
// Handle dropdowns.
|
||||
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.
|
||||
} else if ( $setting.hasClass('button-group') ) {
|
||||
|
@ -1825,10 +1825,10 @@ function wp_print_media_templates() {
|
||||
<#
|
||||
var size = data.sizes['<?php echo esc_js( $value ); ?>'];
|
||||
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 }}
|
||||
</option>
|
||||
<# } #>>
|
||||
<# } #>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
|
Loading…
Reference in New Issue
Block a user