diff --git a/src/wp-includes/js/media/controllers/cropper.js b/src/wp-includes/js/media/controllers/cropper.js index c1a35beb98..a23b226406 100644 --- a/src/wp-includes/js/media/controllers/cropper.js +++ b/src/wp-includes/js/media/controllers/cropper.js @@ -18,8 +18,10 @@ Cropper = wp.media.controller.State.extend({ toolbar: 'crop', content: 'crop', router: false, + canSkipCrop: false, - canSkipCrop: false + // Default doCrop Ajax arguments to allow the Customizer (for example) to inject state. + doCropArgs: {} }, activate: function() { @@ -103,11 +105,15 @@ Cropper = wp.media.controller.State.extend({ }, doCrop: function( attachment ) { - return wp.ajax.post( 'custom-header-crop', { - nonce: attachment.get('nonces').edit, - id: attachment.get('id'), - cropDetails: attachment.get('cropDetails') - } ); + return wp.ajax.post( 'custom-header-crop', _.extend( + {}, + this.defaults.doCropArgs, + { + nonce: attachment.get( 'nonces' ).edit, + id: attachment.get( 'id' ), + cropDetails: attachment.get( 'cropDetails' ) + } + ) ); } });