diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index fad1087..b3d8fc4 100644
|
|
|
3327 | 3327 | var self = this, |
3328 | 3328 | processing = api.state( 'processing' ), |
3329 | 3329 | submitWhenDoneProcessing, |
3330 | | submit; |
| 3330 | submit, |
| 3331 | modifiedWhileSaving = {}; |
3331 | 3332 | |
3332 | 3333 | body.addClass( 'saving' ); |
3333 | 3334 | |
| 3335 | function captureSettingModifiedDuringSave( setting ) { |
| 3336 | modifiedWhileSaving[ setting.id ] = true; |
| 3337 | } |
| 3338 | api.bind( 'change', captureSettingModifiedDuringSave ); |
| 3339 | |
3334 | 3340 | submit = function () { |
3335 | 3341 | var request, query; |
3336 | 3342 | query = $.extend( self.query(), { |
… |
… |
|
3338 | 3344 | } ); |
3339 | 3345 | request = wp.ajax.post( 'customize_save', query ); |
3340 | 3346 | |
| 3347 | // Disable save button during the save request. |
| 3348 | saveBtn.prop( 'disabled', true ); |
| 3349 | |
3341 | 3350 | api.trigger( 'save', request ); |
3342 | 3351 | |
3343 | 3352 | request.always( function () { |
3344 | 3353 | body.removeClass( 'saving' ); |
| 3354 | saveBtn.prop( 'disabled', false ); |
| 3355 | api.unbind( 'change', captureSettingModifiedDuringSave ); |
3345 | 3356 | } ); |
3346 | 3357 | |
3347 | 3358 | request.fail( function ( response ) { |
… |
… |
|
3365 | 3376 | } ); |
3366 | 3377 | |
3367 | 3378 | request.done( function( response ) { |
3368 | | // Clear setting dirty states |
3369 | | api.each( function ( value ) { |
3370 | | value._dirty = false; |
| 3379 | |
| 3380 | // Clear setting dirty states, if setting wasn't modified while saving. |
| 3381 | api.each( function( setting ) { |
| 3382 | if ( ! modifiedWhileSaving[ setting.id ] ) { |
| 3383 | setting._dirty = false; |
| 3384 | } |
3371 | 3385 | } ); |
3372 | 3386 | |
3373 | 3387 | api.previewer.send( 'saved', response ); |
3374 | 3388 | |
3375 | 3389 | api.trigger( 'saved', response ); |
| 3390 | |
| 3391 | // Restore the global dirty state if any settings were modified during save. |
| 3392 | if ( ! _.isEmpty( modifiedWhileSaving ) ) { |
| 3393 | api.state( 'saved' ).set( false ); |
| 3394 | } |
3376 | 3395 | } ); |
3377 | 3396 | }; |
3378 | 3397 | |