Make WordPress Core

Changeset 26989


Ignore:
Timestamp:
01/21/2014 04:29:30 PM (11 years ago)
Author:
wonderboymusic
Message:

Disambiguate this and use the @this annotation in media-editor.js. This will become way more necessary in other places, but a few examples here show how confusing it can be.

See #26870.

File:
1 edited

Legend:

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

    r26988 r26989  
    504504     */
    505505    wp.media.featuredImage = {
     506        scott: 'yes',
    506507        /**
    507508         * Get the featured image post ID
     
    544545         * @global wp.media.view.l10n
    545546         *
     547         * @this wp.media.featuredImage
     548         *
    546549         * @returns {wp.media.view.MediaFrame.Select} A media workflow.
    547550         */
     
    557560
    558561            this._frame.on( 'toolbar:create:featured-image', function( toolbar ) {
     562                /**
     563                 * @this wp.media.view.MediaFrame.Select
     564                 */
    559565                this.createSelectToolbar( toolbar, {
    560566                    text: wp.media.view.l10n.setFeaturedImage
     
    567573        /**
    568574         * @global wp.media.view.settings
     575         *
     576         * @this wp.media.controller.FeaturedImage
    569577         */
    570578        select: function() {
     
    658666         * @param {Object} [options={}]
    659667         *
     668         * @this wp.media.editor
     669         *
    660670         * @returns {wp.media.view.MediaFrame.Select} A media workflow.
    661671         */
     
    685695                $.when.apply( $, selection.map( function( attachment ) {
    686696                    var display = state.display( attachment ).toJSON();
     697                    /**
     698                     * @this wp.media.editor
     699                     */
    687700                    return this.send.attachment( display, attachment.toJSON() );
    688701                }, this ) ).done( function() {
     
    692705
    693706            workflow.state('gallery-edit').on( 'update', function( selection ) {
     707                /**
     708                 * @this wp.media.editor
     709                 */
    694710                this.insert( wp.media.gallery.shortcode( selection ).string() );
    695711            }, this );
    696712
    697713            workflow.state('embed').on( 'select', function() {
     714                /**
     715                 * @this wp.media.editor
     716                 */
    698717                var state = workflow.state(),
    699718                    type = state.get('type'),
     
    765784         *
    766785         * @param {string} id
     786         *
     787         * @this wp.media.editor
     788         *
    767789         * @returns {wp.media.view.MediaFrame} A media workflow.
    768790         */
     
    775797         *
    776798         * @param {string} id
     799         *
     800         * @this wp.media.editor
    777801         */
    778802        remove: function( id ) {
     
    862886         * @param {string} id
    863887         * @param {Object} options
     888         *
     889         * @this wp.media.editor
     890         *
    864891         * @returns {wp.media.view.MediaFrame}
    865892         */
     
    898925        init: function() {
    899926            $(document.body).on( 'click', '.insert-media', function( event ) {
    900                 var $this = $(this),
    901                     editor = $this.data('editor'),
     927                var elem = $( event.currentTarget ),
     928                    editor = elem.data('editor'),
    902929                    options = {
    903930                        frame:    'post',
     
    914941                //
    915942                // See: http://core.trac.wordpress.org/ticket/22445
    916                 $this.blur();
    917 
    918                 if ( $this.hasClass( 'gallery' ) ) {
     943                elem.blur();
     944
     945                if ( elem.hasClass( 'gallery' ) ) {
    919946                    options.state = 'gallery';
    920947                    options.title = wp.media.view.l10n.createGalleryTitle;
Note: See TracChangeset for help on using the changeset viewer.