Make WordPress Core

Changeset 42352


Ignore:
Timestamp:
12/03/2017 06:46:29 PM (9 years ago)
Author:
adamsilverstein
Message:

Docs: Improve JSDocs for cropper.js.

Props manuelaugustin, bramheijmink.
Fixes #42677.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media/controllers/cropper.js

    r41351 r42352  
    55 * wp.media.controller.Cropper
    66 *
    7  * A state for cropping an image.
     7 * A class for cropping an image when called from the header media customization panel.
    88 *
    99 * @memberOf wp.media.controller
    … …  
    2727        },
    2828
     29        /**
     30         * @summary Opens the crop image window.
     31         *
     32         * Shows the crop image window when called from the Add new image button.
     33         *
     34         * @since 4.2.0
     35         *
     36         * @returns {void}
     37         */
    2938        activate: function() {
    3039                this.frame.on( 'content:create:crop', this.createCropContent, this );
    … …  
    3342        },
    3443
     44        /**
     45         * @summary Changes the state of the toolbar window to browse mode.
     46         *
     47         * @since 4.2.0
     48         *
     49         * @returns {void}
     50         */
    3551        deactivate: function() {
    3652                this.frame.toolbar.mode('browse');
    3753        },
    3854
     55        /**
     56         * @summary Creates the crop image window.
     57         *
     58         * Initialized when clicking on the Select and Crop button.
     59         *
     60         * @since 4.2.0
     61         *
     62         * @fires crop window
     63         *
     64         * @returns {void}
     65         */
    3966        createCropContent: function() {
    4067                this.cropperView = new wp.media.view.Cropper({
    … …  
    4673
    4774        },
     75
     76        /**
     77         * @summary Removes the image selection and closes the cropping window.
     78         *
     79         * @since 4.2.0
     80         *
     81         * @returns {void}
     82         */
    4883        removeCropper: function() {
    4984                this.imgSelect.cancelSelection();
    … …  
    5287                this.cropperView.remove();
    5388        },
     89
     90        /**
     91         * @summary Checks if cropping can be skipped and creates crop toolbar accordingly.
     92         *
     93         * @since 4.2.0
     94         *
     95         * @returns {void}
     96         */
    5497        createCropToolbar: function() {
    5598                var canSkipCrop, toolbarOptions;
    … …  
    107150        },
    108151
     152        /**
     153         * @summary Creates an object with the image attachment and crop properties.
     154         *
     155         * @since 4.2.0
     156         *
     157         * @returns {$.promise} A jQuery promise with the custom header crop details.
     158         */
    109159        doCrop: function( attachment ) {
    110160                return wp.ajax.post( 'custom-header-crop', _.extend(
Note: See TracChangeset for help on using the changeset viewer.