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

git-svn-id: http://core.svn.wordpress.org/trunk@22738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-11-21 08:17:45 +00:00
parent c717bb47e2
commit 46bc46d88a

View File

@ -311,7 +311,7 @@
// from the selection.
this.get('selection').off( null, null, this );
wp.Uploader.queue.off( 'add', this.selectUpload, this );
wp.Uploader.queue.off( null, null, this );
this.off( 'change:excludeState', this._excludeState, this );
this.off( 'change:library change:exclude', this.buildComposite, this );
@ -500,6 +500,25 @@
media.controller.Library.prototype.initialize.apply( this, arguments );
},
activate: function() {
var library = this.get('library');
// Limit the library to images only.
library.props.set( 'type', 'image' );
console.log('set', library.props.toJSON(), library.filters );
// Watch for uploaded attachments.
this.get('library').observe( wp.Uploader.queue );
media.controller.Library.prototype.activate.apply( this, arguments );
},
deactivate: function() {
// Stop watching for uploaded attachments.
this.get('library').unobserve( wp.Uploader.queue );
media.controller.Library.prototype.deactivate.apply( this, arguments );
},
sidebar: function() {
media.controller.Library.prototype.sidebar.apply( this, arguments );
this.frame.sidebar.trigger('gallery-settings');