Make WordPress Core

Changeset 27005


Ignore:
Timestamp:
01/22/2014 06:37:08 PM (11 years ago)
Author:
wonderboymusic
Message:

Add inline docs to each method of the namespaced objects in media-editor.js, explaining what each does. Add inline docs to params as well.

See #26870.

File:
1 edited

Legend:

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

    r27000 r27005  
    2222         *
    2323         * @global wp.media.view.settings
     24         * @global getUserSetting()
    2425         *
    2526         * @param {Object} [props={}] Attachment details (align, link, size, etc).
     
    9899            return fallbacks( props );
    99100        },
    100 
    101         /**
    102          * Create the markup for a link
     101        /**
     102         * Create link markup that is suitable for passing to the editor
    103103         *
    104104         * @global wp.html.string
     
    128128        },
    129129        /**
    130          * Create an Audio shortcode
     130         * Create an Audio shortcode string that is suitable for passing to the editor
    131131         *
    132132         * @param {Object} props Attachment details (align, link, size, etc).
     
    138138        },
    139139        /**
    140          * Create a Video shortcode
     140         * Create a Video shortcode string that is suitable for passing to the editor
    141141         *
    142142         * @param {Object} props Attachment details (align, link, size, etc).
     
    148148        },
    149149        /**
    150          * Helper function to create a media shortcode
     150         * Helper function to create a media shortcode string
    151151         *
    152152         * @access private
     
    196196        },
    197197        /**
    198          * Create image markup, optionally with a link and/or wrapped in a caption shortcode
     198         * Create image markup, optionally with a link and/or wrapped in a caption shortcode,
     199         *  that is suitable for passing to the editor
    199200         *
    200201         * @global wp.html
     
    288289        return {
    289290            /**
     291             * Default gallery properties
     292             *
    290293             * @global wp.media.view.settings
     294             * @readonly
    291295             */
    292296            defaults: {
     
    301305                orderby:    'menu_order ID'
    302306            },
    303 
    304307            /**
     308             * Retrieve attachments based on the properties of the passed shortcode
     309             *
    305310             * @global wp.media.query
    306311             *
    307              * @param {wp.shortcode} shortcode
     312             * @param {wp.shortcode} shortcode An instance of wp.shortcode().
    308313             * @returns {wp.media.model.Attachments} A Backbone.Collection containing
    309314             *  the images belonging to a gallery. The 'gallery' prop is a Backbone.Model
     
    364369                return query;
    365370            },
    366 
    367371            /**
    368372             * Triggered when clicking 'Insert Gallery' or 'Update Gallery'
     
    442446             * @global wp.media.view.l10n
    443447             *
    444              * @param {string} content
     448             * @param {string} content Content that is searched for possible
     449             *    shortcode markup matching the passed tag name,
    445450             * @returns {wp.media.view.MediaFrame.Select} A media workflow.
    446451             */
     
    515520            return wp.media.view.settings.post.featuredImageId;
    516521        },
    517 
    518522        /**
    519523         * Set the featured image id, save the post thumbnail data and
     
    523527         * @global wp.media.post
    524528         *
    525          * @param {number} id
     529         * @param {number} id The post ID of the featured image, or -1 to unset it.
    526530         */
    527531        set: function( id ) {
     
    572576        },
    573577        /**
     578         * 'select' callback for Featured Image workflow, triggered when
     579         *  the 'Set Featured Image' button is clicked in the media modal.
     580         *
    574581         * @global wp.media.view.settings
    575582         *
     
    577584         */
    578585        select: function() {
    579             var settings = wp.media.view.settings,
    580                 selection = this.get('selection').single();
    581 
    582             if ( ! settings.post.featuredImageId ) {
     586            var selection = this.get('selection').single();
     587
     588            if ( ! wp.media.view.settings.post.featuredImageId ) {
    583589                return;
    584590            }
     
    586592            wp.media.featuredImage.set( selection ? selection.id : -1 );
    587593        },
    588 
    589594        /**
    590595         * Open the content media manager to the 'featured image' tab when
     
    616621    wp.media.editor = {
    617622        /**
     623         * Send content to the editor
     624         *
    618625         * @global tinymce
    619626         * @global QTags
    620627         * @global wpActiveEditor
    621          *
    622          * @param {string} html
     628         * @global tb_remove() - Possibly overloaded by legacy plugins
     629         *
     630         * @param {string} html Content to send to the editor
    623631         */
    624632        insert: function( html ) {
     
    662670
    663671        /**
     672         * Setup 'workflow' and add to the 'workflows' cache. 'open' can
     673         *  subsequently be called upon it.
     674         *
    664675         * @global wp.media.view.l10n
    665676         *
     
    754765            return workflow;
    755766        },
    756 
    757767        /**
    758768         * Determines the proper current workflow id
     
    761771         * @global tinymce
    762772         *
    763          * @param {string} [id='']
     773         * @param {string} [id=''] A slug used to identify the workflow.
     774         *
    764775         * @returns {wpActiveEditor|string|tinymce.activeEditor.id}
    765776         */
     
    784795         * Return the workflow specified by id
    785796         *
    786          * @param {string} id
     797         * @param {string} id A slug used to identify the workflow.
    787798         *
    788799         * @this wp.media.editor
     
    797808         * Remove the workflow represented by id from the workflow cache
    798809         *
    799          * @param {string} id
     810         * @param {string} id A slug used to identify the workflow.
    800811         *
    801812         * @this wp.media.editor
     
    805816            delete workflows[ id ];
    806817        },
    807 
     818        /**
     819         * @namespace
     820         */
    808821        send: {
    809822            /**
     
    885898        },
    886899        /**
    887          * @param {string} id
     900         * Open a workflow
     901         *
     902         * @param {string} [id=undefined] Optional. A slug used to identify the workflow.
    888903         * @param {Object} [options={}]
    889904         *
Note: See TracChangeset for help on using the changeset viewer.