WordPress.org

Make WordPress Core

Changeset 23008


Ignore:
Timestamp:
12/04/2012 04:04:45 AM (5 years ago)
Author:
nacin
Message:

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.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/media-views.js

    r23006 r23008  
    37463746            var value = this.model.get( key ),
    37473747                $setting = this.$('[data-setting="' + key + '"]'),
    3748                 $buttons;
     3748                $buttons, $value;
    37493749
    37503750            // Bail if we didn't find a matching setting.
     
    37573757            // Handle dropdowns.
    37583758            if ( $setting.is('select') ) {
    3759                 $setting.find('[value="' + value + '"]').attr( 'selected', true );
     3759                $value = $setting.find('[value="' + value + '"]');
     3760
     3761                if ( $value.length ) {
     3762                    $value.attr( 'selected', true );
     3763                } else {
     3764                    // If we can't find the desired value, record what *is* selected.
     3765                    this.model.set( $setting.data('setting'), $setting.find('[selected]').val() );
     3766                }
     3767
    37603768
    37613769            // Handle button groups.
  • trunk/wp-includes/media.php

    r23006 r23008  
    18261826                        var size = data.sizes['<?php echo esc_js( $value ); ?>'];
    18271827                        if ( size ) { #>
    1828                             <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'medium' ); ?>>
     1828                            <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
    18291829                                <?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
    18301830                            </option>
    1831                         <# } #>>
     1831                        <# } #>
    18321832                    <?php endforeach; ?>
    18331833                </select>
Note: See TracChangeset for help on using the changeset viewer.