WordPress.org

Make WordPress Core

Ticket #39099: 39099.1.diff

File 39099.1.diff, 2.1 KB (added by westonruter, 4 years ago)
  • src/wp-includes/js/customize-preview-nav-menus.js

    diff --git src/wp-includes/js/customize-preview-nav-menus.js src/wp-includes/js/customize-preview-nav-menus.js
    index 6745b41be8..5aa9e3d104 100644
    wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( 
    2121                 * Keep track of whether we synced to determine whether or not bindSettingListener
    2222                 * should also initially fire the listener. This initial firing needs to wait until
    2323                 * after all of the settings have been synced from the pane in order to prevent
    24                  * an infinite selective fallback-refresh. Note that this sync handler will be
    25                  * added after the sync handler in customize-preview.js, so it will be triggered
    26                  * after all of the settings are added.
     24                 * an infinite selective fallback-refresh. Note that the active message is sent
     25                 * from the controls once the synced message is sent from the preview.
    2726                 */
    28                 api.preview.bind( 'sync', function() {
     27                api.preview.bind( 'active', function() {
    2928                        synced = true;
    3029                } );
    3130
  • src/wp-includes/js/customize-selective-refresh.js

    diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
    index 4c4fa0d9cf..fedc82390d 100644
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    967967                        setting.unbind( handleSettingChange );
    968968                };
    969969
    970                 api.bind( 'add', watchSettingChange );
     970                api.preview.bind( 'sync', function( events ) {
     971                        api.bind( 'add', watchSettingChange );
     972
     973                        // Capture the settings that were modified during loading to trigger change events to trigger selective refresh.
     974                        if ( events['settings-modified-while-loading'] ) {
     975                                _.each( _.keys( events['settings-modified-while-loading'] ), function( settingId ) {
     976                                        var setting = api( settingId );
     977                                        if ( setting ) {
     978                                                handleSettingChange.call( setting, setting(), setting() );
     979                                        }
     980                                } );
     981                        }
     982                } );
    971983                api.bind( 'remove', unwatchSettingChange );
    972984                api.each( function( setting ) {
    973985                        setting.bind( handleSettingChange );