From ad57f8d6f9a22adc858d4962cfda9d324b547373 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Thu, 10 Mar 2016 05:41:04 +0000 Subject: [PATCH] Customize: Update `cropper.js` to match changes in [36866]. `media-views.js` was updated, but the changes weren't added to `cropper.js`, which caused the `grunt precommit:js` job to incorrectly remove the changes from `media-views.js`. Fixes #32783. git-svn-id: https://develop.svn.wordpress.org/trunk@36931 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/media/controllers/cropper.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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' ) + } + ) ); } });