diff --git src/wp-includes/js/media-models.js src/wp-includes/js/media-models.js
index 19e9021..f024b08 100644
|
|
window.wp = window.wp || {}; |
322 | 322 | }, data ) ).done( function( resp, status, xhr ) { |
323 | 323 | model.set( model.parse( resp, xhr ), options ); |
324 | 324 | }); |
| 325 | }, |
| 326 | crop: function( cropDetails ) { |
| 327 | var model = this; |
| 328 | |
| 329 | return wp.ajax.post( 'custom-header-crop', { |
| 330 | nonce: this.get('nonces').edit, |
| 331 | id: this.get('id'), |
| 332 | cropDetails: cropDetails |
| 333 | } ).done( function( resp, status, xhr ) { |
| 334 | model.set( model.parse( resp, xhr ) ); |
| 335 | }); |
325 | 336 | } |
326 | 337 | }, { |
327 | 338 | /** |
diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index be0ee8f..6f73bfb 100644
|
|
|
1287 | 1287 | activate: function() { |
1288 | 1288 | this.frame.on( 'content:create:crop', this.createCropContent, this ); |
1289 | 1289 | this.frame.on( 'close', this.removeCropper, this ); |
1290 | | this.set('selection', new Backbone.Collection(this.frame._selection.single)); |
| 1290 | this.set('selection', new media.model.Selection(this.frame._selection.single)); |
1291 | 1291 | }, |
1292 | 1292 | |
1293 | 1293 | deactivate: function() { |
… |
… |
|
1323 | 1323 | |
1324 | 1324 | click: function() { |
1325 | 1325 | var self = this, |
1326 | | selection = this.controller.state().get('selection').first(); |
1327 | | |
1328 | | selection.set({cropDetails: this.controller.state().imgSelect.getSelection()}); |
| 1326 | cropDetails = this.controller.state().imgSelect.getSelection(), |
| 1327 | selection = this.controller.state().get('selection').single(); |
1329 | 1328 | |
1330 | 1329 | this.$el.text(l10n.cropping); |
1331 | 1330 | this.$el.attr('disabled', true); |
1332 | | this.controller.state().doCrop( selection ).done( function( croppedImage ) { |
| 1331 | selection.crop(cropDetails).done( function( croppedImage ) { |
1333 | 1332 | self.controller.trigger('cropped', croppedImage ); |
1334 | 1333 | self.controller.close(); |
1335 | 1334 | }); |
… |
… |
|
1346 | 1345 | priority: 70, |
1347 | 1346 | requires: { library: false, selection: false }, |
1348 | 1347 | click: function() { |
1349 | | var selection = this.controller.state().get('selection').first(); |
| 1348 | var selection = this.controller.state().get('selection').single(); |
1350 | 1349 | this.controller.state().cropperView.remove(); |
1351 | 1350 | this.controller.trigger('skippedcrop', selection); |
1352 | 1351 | this.controller.close(); |
… |
… |
|
1356 | 1355 | } |
1357 | 1356 | |
1358 | 1357 | this.frame.toolbar.set( new wp.media.view.Toolbar(toolbarOptions) ); |
1359 | | }, |
1360 | | |
1361 | | doCrop: function( attachment ) { |
1362 | | return wp.ajax.post( 'custom-header-crop', { |
1363 | | nonce: attachment.get('nonces').edit, |
1364 | | id: attachment.get('id'), |
1365 | | cropDetails: attachment.get('cropDetails') |
1366 | | } ); |
1367 | 1358 | } |
1368 | 1359 | }); |
1369 | 1360 | |