diff --git a/wp-includes/js/media-models.js b/wp-includes/js/media-models.js index b7ab0c4573..a50edf4210 100644 --- a/wp-includes/js/media-models.js +++ b/wp-includes/js/media-models.js @@ -358,6 +358,11 @@ window.wp = window.wp || {}; }, validate: function( attachment, options ) { + // Only retain the `silent` option. + options = { + silent: options && options.silent + }; + return this[ this.validator( attachment ) ? 'add' : 'remove' ]( attachment, options ); }, diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 95f1aa6f76..e5b67d9ca5 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -458,9 +458,10 @@ // --------------------------- media.controller.Upload = media.controller.Library.extend({ defaults: _.defaults({ - id: 'upload', - upload: { text: l10n.uploadMoreFiles }, - searchable: false + id: 'upload', + upload: { text: l10n.uploadMoreFiles }, + searchable: false, + sortable: true }, media.controller.Library.prototype.defaults ), initialize: function() { @@ -471,10 +472,6 @@ // all uploading) attachments. if ( ! library ) { library = new Attachments(); - library.props.set({ - orderby: 'date', - order: 'ASC' - }); library.observe( wp.Uploader.queue ); this.set( 'library', library ); } @@ -995,7 +992,8 @@ // Main states. new media.controller.Library( _.defaults({ selection: options.selection, - library: media.query( options.library ) + library: media.query( options.library ), + editable: true }, main ) ), new media.controller.Upload( main ), @@ -1256,7 +1254,8 @@ // Toolbars mainAttachmentsToolbar: function() { this.toolbar.view( new media.view.Toolbar.Insert({ - controller: this + controller: this, + editable: this.state().get('editable') }) ); }, @@ -1770,7 +1769,9 @@ collection: selection, priority: -40, - editable: function() { + // If the selection is editable, pass the callback to + // switch the content mode. + editable: this.options.editable && function() { this.controller.content.mode('edit-selection'); } }).render(),