Make WordPress Core

Ticket #30031: 30031.diff

File 30031.diff, 3.9 KB (added by westonruter, 10 years ago)

https://github.com/xwpco/wordpress-develop/pull/33

  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index fad223e..b1f2ebc 100644
     
    170170                                        control.setting.set( false );
    171171                                }
    172172                        });
     173
     174                        this.setting.bind( function ( value ) {
     175                                picker.val( value );
     176                                picker.wpColorPicker( 'color', value );
     177                        });
    173178                }
    174179        });
    175180
  • src/wp-content/themes/twentyfifteen/js/color-scheme-control.js

    diff --git src/wp-content/themes/twentyfifteen/js/color-scheme-control.js src/wp-content/themes/twentyfifteen/js/color-scheme-control.js
    index 4462f98..46f4a47 100644
     
    55 * Adds listener to Color Scheme control to update other color controls with new values/defaults
    66 */
    77
    8 ( function( wp ) {
    9         wp.customize.controlConstructor.colorScheme = wp.customize.Control.extend( {
     8( function( customize ) {
     9        customize.controlConstructor.colorScheme = customize.Control.extend( {
    1010                ready: function() {
    11                         var parentSection    = this.container.closest( '.control-section' ),
    12                                 headerTextColor  = parentSection.find( '#customize-control-header_textcolor .color-picker-hex' ),
    13                                 backgroundColor  = parentSection.find( '#customize-control-background_color .color-picker-hex' ),
    14                                 sidebarColor     = parentSection.find( '#customize-control-header_background_color .color-picker-hex' ),
    15                                 sidebarTextColor = parentSection.find( '#customize-control-sidebar_textcolor .color-picker-hex' );
    1611
    1712                        this.setting.bind( 'change', function( value ) {
    1813                                // if Header Text is not hidden, update value
    19                                 if ( 'blank' !== wp.customize( 'header_textcolor' ).get() ) {
    20                                         wp.customize( 'header_textcolor' ).set( colorScheme[value].colors[4] );
    21                                         headerTextColor.val( colorScheme[value].colors[4] )
     14                                if ( 'blank' !== customize( 'header_textcolor' ).get() ) {
     15                                        customize( 'header_textcolor' ).set( colorScheme[value].colors[4] );
     16                                        customize.control( 'header_textcolor' ).container.find( '.color-picker-hex' )
    2217                                                .data( 'data-default-color', colorScheme[value].colors[4] )
    23                                                 .wpColorPicker( 'color', colorScheme[value].colors[4] )
    2418                                                .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] );
    2519                                }
    2620
    2721                                // update Background Color
    28                                 wp.customize( 'background_color' ).set( colorScheme[value].colors[0] );
    29                                 backgroundColor.val( colorScheme[value].colors[0] )
     22                                customize( 'background_color' ).set( colorScheme[value].colors[0] );
     23                                customize.control( 'background_color' ).container.find( '.color-picker-hex' )
    3024                                        .data( 'data-default-color', colorScheme[value].colors[0] )
    31                                         .wpColorPicker( 'color', colorScheme[value].colors[0] )
    3225                                        .wpColorPicker( 'defaultColor', colorScheme[value].colors[0] );
    3326
    3427                                // update Header/Sidebar Background Color
    35                                 wp.customize( 'header_background_color' ).set( colorScheme[value].colors[1] );
    36                                 sidebarColor.val( colorScheme[value].colors[1] )
     28                                customize( 'header_background_color' ).set( colorScheme[value].colors[1] );
     29                                customize.control( 'header_background_color' ).container.find( '.color-picker-hex' )
    3730                                        .data( 'data-default-color', colorScheme[value].colors[1] )
    38                                         .wpColorPicker( 'color', colorScheme[value].colors[1] )
    3931                                        .wpColorPicker( 'defaultColor', colorScheme[value].colors[1] );
    4032
    4133                                // update Sidebar Text Color
    42                                 wp.customize( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] );
    43                                 sidebarTextColor.val( colorScheme[value].colors[4] )
     34                                customize( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] );
     35                                customize.control( 'sidebar_textcolor' ).container.find( '.color-picker-hex' )
    4436                                        .data( 'data-default-color', colorScheme[value].colors[4] )
    45                                         .wpColorPicker( 'color', colorScheme[value].colors[4] )
    4637                                        .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] );
    4738                        } );
    4839                }
    4940        } );
    50 } )( this.wp );
    51  No newline at end of file
     41} )( this.wp.customize );