Customize: Add support for flex sizes in CustomizeImageCropper.

Ensures that `$flex_width` and `$flex_height` as specified on `WP_Customize_Cropped_Image_Control` will be honored when a crop is saved.

See #36255.
Fixes #34851.


git-svn-id: https://develop.svn.wordpress.org/trunk@37042 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2016-03-22 03:54:58 +00:00
parent 2399173712
commit 48b70c3504
2 changed files with 12 additions and 4 deletions
+6 -2
View File
@@ -402,8 +402,12 @@ CustomizeImageCropper = Controller.Cropper.extend({
var cropDetails = attachment.get( 'cropDetails' ),
control = this.get( 'control' );
cropDetails.dst_width = control.params.width;
cropDetails.dst_height = control.params.height;
if ( ! control.params.flex_width ) {
cropDetails.dst_width = control.params.width;
}
if ( ! control.params.flex_height ) {
cropDetails.dst_height = control.params.height;
}
return wp.ajax.post( 'crop-image', {
wp_customize: 'on',
@@ -16,8 +16,12 @@ CustomizeImageCropper = Controller.Cropper.extend({
var cropDetails = attachment.get( 'cropDetails' ),
control = this.get( 'control' );
cropDetails.dst_width = control.params.width;
cropDetails.dst_height = control.params.height;
if ( ! control.params.flex_width ) {
cropDetails.dst_width = control.params.width;
}
if ( ! control.params.flex_height ) {
cropDetails.dst_height = control.params.height;
}
return wp.ajax.post( 'crop-image', {
wp_customize: 'on',