Make WordPress Core

Ticket #28459: 28459.6.diff

File 28459.6.diff, 12.6 KB (added by DrewAPicture, 12 years ago)

Some @since tags

  • src/wp-includes/js/media-views.js

     
    9494                /**
    9595                 * Activate a mode.
    9696                 *
     97                 * @since 3.5.0
     98                 *
    9799                 * @param {string} mode
    98100                 *
    99101                 * @fires this.view#{this.id}:activate:{this._mode}
     
    135137                /**
    136138                 * Render a mode.
    137139                 *
     140                 * @since 3.5.0
     141                 *
    138142                 * @param {string} mode
    139143                 *
    140144                 * @fires this.view#{this.id}:create:{this._mode}
     
    182186                /**
    183187                 * Get the region's view.
    184188                 *
     189                 * @since 3.5.0
     190                 *
    185191                 * @returns {wp.media.View}
    186192                 */
    187193                get: function() {
     
    191197                /**
    192198                 * Set the region's view as a subview of the frame.
    193199                 *
     200                 * @since 3.5.0
     201                 *
    194202                 * @param {Array|Object} views
    195203                 * @param {Object} [options={}]
    196204                 * @returns {wp.Backbone.Subviews} Subviews is returned to allow chaining
     
    205213                /**
    206214                 * Trigger regional view events on the frame.
    207215                 *
     216                 * @since 3.5.0
     217                 *
    208218                 * @param {string} event
    209219                 * @returns {undefined|wp.media.controller.Region} Returns itself to allow chaining.
    210220                 */
     
    232242        /**
    233243         * wp.media.controller.StateMachine
    234244         *
     245         * @since 3.5.0
     246         *
    235247         * @constructor
    236248         * @augments Backbone.Model
    237249         * @mixin
     
    257269                 * Ensure that the `states` collection exists so the `StateMachine`
    258270                 *   can be used as a mixin.
    259271                 *
     272                 * @since 3.5.0
     273                 *
    260274                 * @param {string} id
    261275                 * @returns {wp.media.controller.State} Returns a State model
    262276                 *   from the StateMachine collection
     
    280294                 * created the `states` collection, or are trying to select a state
    281295                 * that does not exist.
    282296                 *
     297                 * @since 3.5.0
     298                 *
    283299                 * @param {string} id
    284300                 *
    285301                 * @fires wp.media.controller.State#deactivate
     
    311327                 * Call the `state()` method with no parameters to retrieve the current
    312328                 * active state.
    313329                 *
     330                 * @since 3.5.0
     331                 *
    314332                 * @returns {wp.media.controller.State} Returns a State model
    315333                 *    from the StateMachine collection
    316334                 */
     
    347365         * @augments Backbone.Model
    348366         */
    349367        media.controller.State = Backbone.Model.extend({
     368                /**
     369                 * Constructor.
     370                 *
     371                 * @since 3.5.0
     372                 */
    350373                constructor: function() {
    351374                        this.on( 'activate', this._preActivate, this );
    352375                        this.on( 'activate', this.activate, this );
     
    364387                },
    365388                /**
    366389                 * @abstract
     390                 * @since 3.5.0
    367391                 */
    368392                ready: function() {},
     393
    369394                /**
    370395                 * @abstract
     396                 * @since 3.5.0
    371397                 */
    372398                activate: function() {},
     399
    373400                /**
    374401                 * @abstract
     402                 * @since 3.5.0
    375403                 */
    376404                deactivate: function() {},
     405
    377406                /**
    378407                 * @abstract
     408                 * @since 3.5.0
    379409                 */
    380410                reset: function() {},
     411
    381412                /**
    382413                 * @access private
     414                 * @since 4.0.0
    383415                 */
    384416                _ready: function() {
    385417                        this._updateMenu();
    386418                },
     419
    387420                /**
    388421                 * @access private
     422                 * @since 3.5.0
    389423                */
    390424                _preActivate: function() {
    391425                        this.active = true;
    392426                },
     427
    393428                /**
    394429                 * @access private
     430                 * @since 3.5.0
    395431                 */
    396432                _postActivate: function() {
    397433                        this.on( 'change:menu', this._menu, this );
     
    407443                        this._content();
    408444                        this._router();
    409445                },
     446
    410447                /**
    411448                 * @access private
     449                 * @since 3.5.0
    412450                 */
    413451                _deactivate: function() {
    414452                        this.active = false;
     
    420458                        this.off( 'change:content', this._content, this );
    421459                        this.off( 'change:toolbar', this._toolbar, this );
    422460                },
     461
    423462                /**
    424463                 * @access private
     464                 * @since 3.5.0
    425465                 */
    426466                _title: function() {
    427467                        this.frame.title.render( this.get('titleMode') || 'default' );
    428468                },
     469
    429470                /**
    430471                 * @access private
     472                 * @since 3.5.0
    431473                 */
    432474                _renderTitle: function( view ) {
    433475                        view.$el.text( this.get('title') || '' );
    434476                },
     477
    435478                /**
    436479                 * @access private
     480                 * @since 3.5.0
    437481                 */
    438482                _router: function() {
    439483                        var router = this.frame.router,
     
    452496                                view.select( this.frame.content.mode() );
    453497                        }
    454498                },
     499
    455500                /**
    456501                 * @access private
     502                 * @since 3.5.0
    457503                 */
    458504                _menu: function() {
    459505                        var menu = this.frame.menu,
     
    471517                                view.select( this.id );
    472518                        }
    473519                },
     520
    474521                /**
    475522                 * @access private
     523                 * @since 3.5.0
    476524                 */
    477525                _updateMenu: function() {
    478526                        var previous = this.previous('menu'),
     
    486534                                this.frame.on( 'menu:render:' + menu, this._renderMenu, this );
    487535                        }
    488536                },
     537
    489538                /**
    490539                 * @access private
     540                 * @since 3.5.0
    491541                 */
    492542                _renderMenu: function( view ) {
    493543                        var menuItem = this.get('menuItem'),
     
    523573        });
    524574
    525575        media.selectionSync = {
     576                /**
     577                 * @since 3.5.0
     578                 */
    526579                syncSelection: function() {
    527580                        var selection = this.get('selection'),
    528581                                manager = this.frame._selection;
     
    550603                 * of the selection's attachments and the set of selected
    551604                 * attachments that this specific selection considered invalid.
    552605                 * Reset the difference and record the single attachment.
     606                 *
     607                 * @since 3.5.0
    553608                 */
    554609                recordSelection: function() {
    555610                        var selection = this.get('selection'),
     
    603658                /**
    604659                 * If a library isn't provided, query all media items.
    605660                 * If a selection instance isn't provided, create one.
     661                 *
     662                 * @since 3.5.0
    606663                 */
    607664                initialize: function() {
    608665                        var selection = this.get('selection'),
     
    641698                        this.resetDisplays();
    642699                },
    643700
     701                /**
     702                 * @since 3.5.0
     703                 */
    644704                activate: function() {
    645705                        this.syncSelection();
    646706
     
    654714                        }
    655715                },
    656716
     717                /**
     718                 * @since 3.5.0
     719                 */
    657720                deactivate: function() {
    658721                        this.recordSelection();
    659722
     
    666729                        wp.Uploader.queue.off( null, null, this );
    667730                },
    668731
     732                /**
     733                 * @since 3.5.0
     734                 */
    669735                reset: function() {
    670736                        this.get('selection').reset();
    671737                        this.resetDisplays();
    672738                        this.refreshContent();
    673739                },
    674740
     741                /**
     742                 * @since 3.5.0
     743                 */
    675744                resetDisplays: function() {
    676745                        var defaultProps = media.view.settings.defaultProps;
    677746                        this._displays = [];
     
    683752                },
    684753
    685754                /**
     755                 * @since 3.5.0
     756                 *
    686757                 * @param {wp.media.model.Attachment} attachment
    687758                 * @returns {Backbone.Model}
    688759                 */
     
    696767                },
    697768
    698769                /**
     770                 * @since 3.6.0
     771                 *
    699772                 * @param {wp.media.model.Attachment} attachment
    700773                 * @returns {Object}
    701774                 */
     
    708781                },
    709782
    710783                /**
     784                 * @since 3.6.0
     785                 *
    711786                 * @param {wp.media.model.Attachment} attachment
    712787                 * @returns {Boolean}
    713788                 */
     
    728803                 * If the state is active, no items are selected, and the current
    729804                 * content mode is not an option in the state's router (provided
    730805                 * the state has a router), reset the content mode to the default.
     806                 *
     807                 * @since 3.5.0
    731808                 */
    732809                refreshContent: function() {
    733810                        var selection = this.get('selection'),
     
    749826                 * limit themselves to one attachment (in this case, the last
    750827                 * attachment in the upload queue).
    751828                 *
     829                 * @since 3.5.0
     830                 *
    752831                 * @param {wp.media.model.Attachment} attachment
    753832                 */
    754833                uploading: function( attachment ) {
     
    762841
    763842                /**
    764843                 * Only track the browse router on library states.
     844                 *
     845                 * @since 3.5.0
    765846                 */
    766847                saveContentMode: function() {
    767848                        if ( 'browse' !== this.get('router') ) {
     
    800881                        priority: 60
    801882                }, media.controller.Library.prototype.defaults ),
    802883
     884                /**
     885                 * @since 3.9.0
     886                 *
     887                 * @param options Attributes
     888                 */
    803889                initialize: function( options ) {
    804890                        this.image = options.image;
    805891                        media.controller.State.prototype.initialize.apply( this, arguments );
    806892                },
    807893
     894                /**
     895                 * @since 3.9.0
     896                 */
    808897                activate: function() {
    809898                        this.frame.modal.$el.addClass('image-details');
    810899                }
     
    843932                        syncSelection: false
    844933                },
    845934
     935                /**
     936                 * @since 3.9.0
     937                 */
    846938                initialize: function() {
    847939                        // If we haven't been provided a `library`, create a `Selection`.
    848940                        if ( ! this.get('library') )
     
    854946                        media.controller.Library.prototype.initialize.apply( this, arguments );
    855947                },
    856948
     949                /**
     950                 * since 3.9.0
     951                 */
    857952                activate: function() {
    858953                        var library = this.get('library');
    859954
     
    868963                        media.controller.Library.prototype.activate.apply( this, arguments );
    869964                },
    870965
     966                /**
     967                 * @since 3.9.0
     968                 */
    871969                deactivate: function() {
    872970                        // Stop watching for uploaded attachments.
    873971                        this.get('library').unobserve( wp.Uploader.queue );
     
    877975                        media.controller.Library.prototype.deactivate.apply( this, arguments );
    878976                },
    879977
     978                /**
     979                 * @since 3.9.0
     980                 *
     981                 * @param browser
     982                 */
    880983                gallerySettings: function( browser ) {
    881984                        if ( ! this.get('displaySettings') ) {
    882985                                return;
     
    9351038                        syncSelection: false
    9361039                }, media.controller.Library.prototype.defaults ),
    9371040
     1041                /**
     1042                 * @since 3.9.0
     1043                 */
    9381044                initialize: function() {
    9391045                        // If we haven't been provided a `library`, create a `Selection`.
    9401046                        if ( ! this.get('library') )
     
    9431049                        media.controller.Library.prototype.initialize.apply( this, arguments );
    9441050                },
    9451051
     1052                /**
     1053                 * @since 3.9.0
     1054                 */
    9461055                activate: function() {
    9471056                        var library = this.get('library'),
    9481057                                edit    = this.frame.state('gallery-edit').get('library');
     
    9971106                        syncSelection: false
    9981107                },
    9991108
     1109                /**
     1110                 * @since 3.9.0
     1111                 */
    10001112                initialize: function() {
    10011113                        var collectionType = this.get('collectionType');
    10021114
     
    10181130                        media.controller.Library.prototype.initialize.apply( this, arguments );
    10191131                },
    10201132
     1133                /**
     1134                 * @since 3.9.0
     1135                 */
    10211136                activate: function() {
    10221137                        var library = this.get('library');
    10231138
     
    10321147                        media.controller.Library.prototype.activate.apply( this, arguments );
    10331148                },
    10341149
     1150                /**
     1151                 * @since 3.9.0
     1152                 */
    10351153                deactivate: function() {
    10361154                        // Stop watching for uploaded attachments.
    10371155                        this.get('library').unobserve( wp.Uploader.queue );
     
    10411159                        media.controller.Library.prototype.deactivate.apply( this, arguments );
    10421160                },
    10431161
     1162                /**
     1163                 * @since 3.9.0
     1164                 *
     1165                 * @param browser
     1166                 */
    10441167                renderSettings: function( browser ) {
    10451168                        var library = this.get('library'),
    10461169                                collectionType = this.get('collectionType'),
     
    10991222                        syncSelection: false
    11001223                }, media.controller.Library.prototype.defaults ),
    11011224
     1225                /**
     1226                 * @since 3.9.0
     1227                 */
    11021228                initialize: function() {
    11031229                        var collectionType = this.get('collectionType');
    11041230
     
    11171243                        media.controller.Library.prototype.initialize.apply( this, arguments );
    11181244                },
    11191245
     1246                /**
     1247                 * @since 3.9.0
     1248                 */
    11201249                activate: function() {
    11211250                        var library = this.get('library'),
    11221251                                editLibrary = this.get('editLibrary'),
     
    11661295                        syncSelection: true
    11671296                }, media.controller.Library.prototype.defaults ),
    11681297
     1298                /**
     1299                 * @since 3.5.0
     1300                 */
    11691301                initialize: function() {
    11701302                        var library, comparator;
    11711303
     
    11991331                        library.observe( this.get('selection') );
    12001332                },
    12011333
     1334                /**
     1335                 * @since 3.5.0
     1336                 */
    12021337                activate: function() {
    12031338                        this.updateSelection();
    12041339                        this.frame.on( 'open', this.updateSelection, this );
     
    12061341                        media.controller.Library.prototype.activate.apply( this, arguments );
    12071342                },
    12081343
     1344                /**
     1345                 * @since 3.5.0
     1346                 */
    12091347                deactivate: function() {
    12101348                        this.frame.off( 'open', this.updateSelection, this );
    12111349
    12121350                        media.controller.Library.prototype.deactivate.apply( this, arguments );
    12131351                },
    12141352
     1353                /**
     1354                 * @since 3.5.0
     1355                 */
    12151356                updateSelection: function() {
    12161357                        var selection = this.get('selection'),
    12171358                                id = media.view.settings.post.featuredImageId,
     
    12491390                        syncSelection: true
    12501391                }, media.controller.Library.prototype.defaults ),
    12511392
     1393                /**
     1394                 * @since 3.9.0
     1395                 *
     1396                 * @param options
     1397                 */
    12521398                initialize: function( options ) {
    12531399                        var library, comparator;
    12541400
     
    12831429                        library.observe( this.get('selection') );
    12841430                },
    12851431
     1432                /**
     1433                 * @since 3.9.0
     1434                 */
    12861435                activate: function() {
    12871436                        this.updateSelection();
    12881437                        media.controller.Library.prototype.activate.apply( this, arguments );
    12891438                },
    12901439
     1440                /**
     1441                 * @since 3.9.0
     1442                 */
    12911443                updateSelection: function() {
    12921444                        var selection = this.get('selection'),
    12931445                                attachment = this.image.attachment;
     
    13151467                        url:     ''
    13161468                },
    13171469
     1470                /**
     1471                 * @since 3.9.0
     1472                 */
    13181473                activate: function() {
    13191474                        this.listenTo( this.frame, 'toolbar:render:edit-image', this.toolbar );
    13201475                },
    13211476
     1477                /**
     1478                 * @since 3.9.0
     1479                 */
    13221480                deactivate: function() {
    13231481                        this.stopListening( this.frame );
    13241482                },
    13251483
     1484                /**
     1485                 * @since 3.9.0
     1486                 */
    13261487                toolbar: function() {
    13271488                        var frame = this.frame,
    13281489                                lastState = frame.lastState(),
     
    13661527                        syncSelection:   false
    13671528                }, media.controller.Library.prototype.defaults ),
    13681529
     1530                /**
     1531                 * @since 3.9.0
     1532                 *
     1533                 * @param options
     1534                 */
    13691535                initialize: function( options ) {
    13701536                        this.media = options.media;
    13711537                        this.type = options.type;
     
    13741540                        media.controller.Library.prototype.initialize.apply( this, arguments );
    13751541                },
    13761542
     1543                /**
     1544                 * @since 3.9.0
     1545                 */
    13771546                activate: function() {
    13781547                        if ( media.frame.lastMime ) {
    13791548                                this.set( 'library', media.query({ type: media.frame.lastMime }) );