Customize: Fix image cropping when doing live preview of theme switches.

Ensure that the Customizer gets bootstrapped with the pre-activated `theme` supplied in the `custom-header-crop` admin ajax requests.

Props faishal, rittesh.patel.
Fixes #32783.

Built from https://develop.svn.wordpress.org/trunk@36866


git-svn-id: http://core.svn.wordpress.org/trunk@36833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-03-06 01:45:27 +00:00
parent fe4a3452c3
commit 40f6779665
5 changed files with 20 additions and 10 deletions

View File

@ -2346,6 +2346,10 @@
api.HeaderTool.UploadsList,
api.HeaderTool.DefaultsList
]);
// Ensure custom-header-crop Ajax requests bootstrap the Customizer to activate the previewed theme.
wp.media.controller.Cropper.prototype.defaults.doCropArgs.wp_customize = 'on';
wp.media.controller.Cropper.prototype.defaults.doCropArgs.theme = api.settings.theme.stylesheet;
},
/**

File diff suppressed because one or more lines are too long

View File

@ -282,8 +282,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() {
@ -367,11 +369,15 @@ Cropper = wp.media.controller.State.extend({
},
doCrop: function( attachment ) {
return wp.ajax.post( 'custom-header-crop', {
return wp.ajax.post( 'custom-header-crop', _.extend(
{},
this.defaults.doCropArgs,
{
nonce: attachment.get( 'nonces' ).edit,
id: attachment.get( 'id' ),
cropDetails: attachment.get( 'cropDetails' )
} );
}
) );
}
});

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-beta2-36865';
$wp_version = '4.5-beta2-36866';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.