WordPress.org

Make WordPress Core

Changeset 22738


Ignore:
Timestamp:
11/21/2012 08:17:45 AM (8 years ago)
Author:
koopersmith
Message:

Media: Dropping images on the edit gallery view will automatically add those images to the gallery. fixes #22521, see #21390.

File:
1 edited

Legend:

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

    r22716 r22738  
    312312            this.get('selection').off( null, null, this );
    313313
    314             wp.Uploader.queue.off( 'add', this.selectUpload, this );
     314            wp.Uploader.queue.off( null, null, this );
    315315
    316316            this.off( 'change:excludeState', this._excludeState, this );
     
    499499                this.set( 'AttachmentView', media.view.Attachment.EditLibrary );
    500500            media.controller.Library.prototype.initialize.apply( this, arguments );
     501        },
     502
     503        activate: function() {
     504            var library = this.get('library');
     505
     506            // Limit the library to images only.
     507            library.props.set( 'type', 'image' );
     508            console.log('set', library.props.toJSON(), library.filters );
     509
     510            // Watch for uploaded attachments.
     511            this.get('library').observe( wp.Uploader.queue );
     512
     513            media.controller.Library.prototype.activate.apply( this, arguments );
     514        },
     515
     516        deactivate: function() {
     517            // Stop watching for uploaded attachments.
     518            this.get('library').unobserve( wp.Uploader.queue );
     519            media.controller.Library.prototype.deactivate.apply( this, arguments );
    501520        },
    502521
Note: See TracChangeset for help on using the changeset viewer.