diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 0abfb77..4901b56 100644
|
|
|
3345 | 3345 | value._dirty = false; |
3346 | 3346 | } ); |
3347 | 3347 | |
| 3348 | api.previewer.send( 'saved', response ); |
| 3349 | |
3348 | 3350 | api.trigger( 'saved', response ); |
3349 | 3351 | } ); |
3350 | 3352 | }; |
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index f5aa604..aa73ed7 100644
|
|
final class WP_Customize_Manager { |
805 | 805 | 'activePanels' => array(), |
806 | 806 | 'activeSections' => array(), |
807 | 807 | 'activeControls' => array(), |
| 808 | '_dirty' => array_keys( $this->unsanitized_post_values() ), |
808 | 809 | ); |
809 | 810 | |
810 | 811 | if ( 2 == $this->nonce_tick ) { |
diff --git src/wp-includes/js/customize-preview.js src/wp-includes/js/customize-preview.js
index 4bf625e..1d18027 100644
|
|
|
84 | 84 | }); |
85 | 85 | |
86 | 86 | $( function() { |
| 87 | var bg, setValue; |
| 88 | |
87 | 89 | api.settings = window._wpCustomizeSettings; |
88 | | if ( ! api.settings ) |
| 90 | if ( ! api.settings ) { |
89 | 91 | return; |
90 | | |
91 | | var bg; |
| 92 | } |
92 | 93 | |
93 | 94 | api.preview = new api.Preview({ |
94 | 95 | url: window.location.href, |
95 | 96 | channel: api.settings.channel |
96 | 97 | }); |
97 | 98 | |
| 99 | /** |
| 100 | * Create/update a setting value. |
| 101 | * |
| 102 | * @param {string} id - Setting ID. |
| 103 | * @param {*} value - Setting value. |
| 104 | * @param {boolean} [createDirty] - Whether to create a setting as dirty. Defaults to false. |
| 105 | */ |
| 106 | setValue = function( id, value, createDirty ) { |
| 107 | var setting = api( id ); |
| 108 | if ( setting ) { |
| 109 | setting.set( value ); |
| 110 | } else { |
| 111 | createDirty = createDirty || false; |
| 112 | setting = api.create( id, value, { |
| 113 | id: id |
| 114 | } ); |
| 115 | |
| 116 | // Mark dynamically-created settings as dirty so they will get posted. |
| 117 | if ( createDirty ) { |
| 118 | setting._dirty = true; |
| 119 | } |
| 120 | } |
| 121 | }; |
| 122 | |
98 | 123 | api.preview.bind( 'settings', function( values ) { |
99 | | $.each( values, function( id, value ) { |
100 | | if ( api.has( id ) ) |
101 | | api( id ).set( value ); |
102 | | else |
103 | | api.create( id, value ); |
104 | | }); |
| 124 | $.each( values, setValue ); |
105 | 125 | }); |
106 | 126 | |
107 | 127 | api.preview.trigger( 'settings', api.settings.values ); |
108 | 128 | |
109 | | api.preview.bind( 'setting', function( args ) { |
110 | | var value; |
111 | | |
112 | | args = args.slice(); |
| 129 | $.each( api.settings._dirty, function( i, id ) { |
| 130 | var setting = api( id ); |
| 131 | if ( setting ) { |
| 132 | setting._dirty = true; |
| 133 | } |
| 134 | } ); |
113 | 135 | |
114 | | if ( value = api( args.shift() ) ) |
115 | | value.set.apply( value, args ); |
| 136 | api.preview.bind( 'setting', function( args ) { |
| 137 | var createDirty = true; |
| 138 | setValue.apply( null, args.concat( createDirty ) ); |
116 | 139 | }); |
117 | 140 | |
118 | 141 | api.preview.bind( 'sync', function( events ) { |
… |
… |
|
130 | 153 | api.preview.send( 'documentTitle', document.title ); |
131 | 154 | }); |
132 | 155 | |
| 156 | api.preview.bind( 'saved', function( response ) { |
| 157 | api.trigger( 'saved', response ); |
| 158 | } ); |
| 159 | |
| 160 | api.bind( 'saved', function() { |
| 161 | api.each( function( setting ) { |
| 162 | setting._dirty = false; |
| 163 | } ); |
| 164 | } ); |
| 165 | |
133 | 166 | /* |
134 | 167 | * Send a message to the parent customize frame with a list of which |
135 | 168 | * containers and controls are active. |