diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 9a6aca9c3d..01d472c536 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -502,6 +502,10 @@ }, initialize: function() { + // If we haven't been provided a `library`, create a `Selection`. + if ( ! this.get('library') ) + this.set( 'library', new media.model.Selection() ); + // The single `Attachment` view to be used in the `Attachments` view. if ( ! this.get('AttachmentView') ) this.set( 'AttachmentView', media.view.Attachment.Gallery ); @@ -846,6 +850,7 @@ // Gallery states. new media.controller.Gallery({ + library: options.selection, editing: options.editing, menu: 'gallery' }),