Docs: Improve JSDocs for cropper.js.
Ammends r42352 - include the built media files. Built from https://develop.svn.wordpress.org/trunk@42353 git-svn-id: http://core.svn.wordpress.org/trunk@42182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
56f0da1f45
commit
9ff1fb5af1
|
@ -2297,7 +2297,7 @@ var l10n = wp.media.view.l10n,
|
||||||
/**
|
/**
|
||||||
* wp.media.controller.Cropper
|
* wp.media.controller.Cropper
|
||||||
*
|
*
|
||||||
* A state for cropping an image.
|
* A class for cropping an image when called from the header media customization panel.
|
||||||
*
|
*
|
||||||
* @memberOf wp.media.controller
|
* @memberOf wp.media.controller
|
||||||
*
|
*
|
||||||
|
@ -2319,16 +2319,43 @@ Cropper = wp.media.controller.State.extend(/** @lends wp.media.controller.Croppe
|
||||||
doCropArgs: {}
|
doCropArgs: {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Opens the crop image window.
|
||||||
|
*
|
||||||
|
* Shows the crop image window when called from the Add new image button.
|
||||||
|
*
|
||||||
|
* @since 4.2.0
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
activate: function() {
|
activate: function() {
|
||||||
this.frame.on( 'content:create:crop', this.createCropContent, this );
|
this.frame.on( 'content:create:crop', this.createCropContent, this );
|
||||||
this.frame.on( 'close', this.removeCropper, this );
|
this.frame.on( 'close', this.removeCropper, this );
|
||||||
this.set('selection', new Backbone.Collection(this.frame._selection.single));
|
this.set('selection', new Backbone.Collection(this.frame._selection.single));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Changes the state of the toolbar window to browse mode.
|
||||||
|
*
|
||||||
|
* @since 4.2.0
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
deactivate: function() {
|
deactivate: function() {
|
||||||
this.frame.toolbar.mode('browse');
|
this.frame.toolbar.mode('browse');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Creates the crop image window.
|
||||||
|
*
|
||||||
|
* Initialized when clicking on the Select and Crop button.
|
||||||
|
*
|
||||||
|
* @since 4.2.0
|
||||||
|
*
|
||||||
|
* @fires crop window
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
createCropContent: function() {
|
createCropContent: function() {
|
||||||
this.cropperView = new wp.media.view.Cropper({
|
this.cropperView = new wp.media.view.Cropper({
|
||||||
controller: this,
|
controller: this,
|
||||||
|
@ -2338,12 +2365,28 @@ Cropper = wp.media.controller.State.extend(/** @lends wp.media.controller.Croppe
|
||||||
this.frame.content.set(this.cropperView);
|
this.frame.content.set(this.cropperView);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Removes the image selection and closes the cropping window.
|
||||||
|
*
|
||||||
|
* @since 4.2.0
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
removeCropper: function() {
|
removeCropper: function() {
|
||||||
this.imgSelect.cancelSelection();
|
this.imgSelect.cancelSelection();
|
||||||
this.imgSelect.setOptions({remove: true});
|
this.imgSelect.setOptions({remove: true});
|
||||||
this.imgSelect.update();
|
this.imgSelect.update();
|
||||||
this.cropperView.remove();
|
this.cropperView.remove();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Checks if cropping can be skipped and creates crop toolbar accordingly.
|
||||||
|
*
|
||||||
|
* @since 4.2.0
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
createCropToolbar: function() {
|
createCropToolbar: function() {
|
||||||
var canSkipCrop, toolbarOptions;
|
var canSkipCrop, toolbarOptions;
|
||||||
|
|
||||||
|
@ -2399,6 +2442,13 @@ Cropper = wp.media.controller.State.extend(/** @lends wp.media.controller.Croppe
|
||||||
this.frame.toolbar.set( new wp.media.view.Toolbar(toolbarOptions) );
|
this.frame.toolbar.set( new wp.media.view.Toolbar(toolbarOptions) );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Creates an object with the image attachment and crop properties.
|
||||||
|
*
|
||||||
|
* @since 4.2.0
|
||||||
|
*
|
||||||
|
* @returns {$.promise} A jQuery promise with the custom header crop details.
|
||||||
|
*/
|
||||||
doCrop: function( attachment ) {
|
doCrop: function( attachment ) {
|
||||||
return wp.ajax.post( 'custom-header-crop', _.extend(
|
return wp.ajax.post( 'custom-header-crop', _.extend(
|
||||||
{},
|
{},
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42352';
|
$wp_version = '5.0-alpha-42353';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue