|
23 | 23 | * See https://github.com/Automattic/wordpress-activitypub/issues/846
|
24 | 24 | */
|
25 | 25 | ImageCropperNoCustomizer = wp.media.controller.CustomizeImageCropper.extend( {
|
26 |
| - doCrop: function ( attachment ) { |
| 26 | + doCrop: function( attachment ) { |
27 | 27 | var cropDetails = attachment.get( 'cropDetails' ),
|
28 | 28 | control = this.get( 'control' ),
|
29 | 29 | ratio = cropDetails.width / cropDetails.height;
|
30 | 30 |
|
31 | 31 | // Use crop measurements when flexible in both directions.
|
32 | 32 | if ( control.params.flex_width && control.params.flex_height ) {
|
33 |
| - cropDetails.dst_width = cropDetails.width; |
| 33 | + cropDetails.dst_width = cropDetails.width; |
34 | 34 | cropDetails.dst_height = cropDetails.height;
|
35 | 35 |
|
36 |
| - // Constrain flexible side based on image ratio and size of the fixed side. |
| 36 | + // Constrain flexible side based on image ratio and size of the fixed side. |
37 | 37 | } else {
|
38 |
| - cropDetails.dst_width = control.params.flex_width |
39 |
| - ? control.params.height * ratio |
40 |
| - : control.params.width; |
41 |
| - cropDetails.dst_height = control.params.flex_height |
42 |
| - ? control.params.width / ratio |
43 |
| - : control.params.height; |
| 38 | + cropDetails.dst_width = control.params.flex_width ? control.params.height * ratio : control.params.width; |
| 39 | + cropDetails.dst_height = control.params.flex_height ? control.params.width / ratio : control.params.height; |
44 | 40 | }
|
45 | 41 |
|
46 | 42 | return wp.ajax.post( 'crop-image', {
|
47 | 43 | // where wp_customize: 'on' would be in Core, for no good reason I understand.
|
48 | 44 | nonce: attachment.get( 'nonces' ).edit,
|
49 | 45 | id: attachment.get( 'id' ),
|
50 | 46 | context: control.id,
|
51 |
| - cropDetails: cropDetails, |
| 47 | + cropDetails: cropDetails |
52 | 48 | } );
|
53 |
| - }, |
| 49 | + } |
54 | 50 | } );
|
55 | 51 |
|
| 52 | + |
| 53 | + |
56 | 54 | /**
|
57 | 55 | * Calculate image selection options based on the attachment dimensions.
|
58 | 56 | *
|
|
205 | 203 | } else {
|
206 | 204 | i18nAppAlternativeString = wp.i18n.sprintf(
|
207 | 205 | /* translators: %s: The selected image filename. */
|
208 |
| - wp.i18n.__( 'Header Image preview: The current image has no alternative text. The file name is: %s' ), |
| 206 | + wp.i18n.__( |
| 207 | + 'Header Image preview: The current image has no alternative text. The file name is: %s' |
| 208 | + ), |
209 | 209 | attributes.filename
|
210 | 210 | );
|
211 | 211 | i18nBrowserAlternativeString = wp.i18n.sprintf(
|
212 | 212 | /* translators: %s: The selected image filename. */
|
213 |
| - wp.i18n.__( 'Header Image preview: The current image has no alternative text. The file name is: %s' ), |
| 213 | + wp.i18n.__( |
| 214 | + 'Header Image preview: The current image has no alternative text. The file name is: %s' |
| 215 | + ), |
214 | 216 | attributes.filename
|
215 | 217 | );
|
216 | 218 | }
|
|
0 commit comments