diff --git a/wp-admin/js/media-upload.js b/wp-admin/js/media-upload.js index 60dc0cb87b..2d9972a4ae 100644 --- a/wp-admin/js/media-upload.js +++ b/wp-admin/js/media-upload.js @@ -103,6 +103,7 @@ var tb_position; return workflow; workflow = workflows[ id ] = wp.media( _.defaults( options || {}, { + frame: 'post', title: wp.media.view.l10n.insertMedia, multiple: true } ) ); diff --git a/wp-includes/js/mce-view.js b/wp-includes/js/mce-view.js index c34c8d4547..345b517a2a 100644 --- a/wp-includes/js/mce-view.js +++ b/wp-includes/js/mce-view.js @@ -694,6 +694,7 @@ window.wp = window.wp || {}; return; this.frame = wp.media({ + frame: 'post', state: 'gallery-edit', title: mceview.l10n.editGallery, editing: true, diff --git a/wp-includes/js/media-models.js b/wp-includes/js/media-models.js index dd42f5ab21..5005ff724e 100644 --- a/wp-includes/js/media-models.js +++ b/wp-includes/js/media-models.js @@ -7,15 +7,30 @@ window.wp = window.wp || {}; * wp.media( attributes ) * * Handles the default media experience. Automatically creates - * and opens a media workflow, and returns the result. + * and opens a media frame, and returns the result. * Does nothing if the controllers do not exist. * * @param {object} attributes The properties passed to the main media controller. * @return {object} A media workflow. */ media = wp.media = function( attributes ) { - if ( media.view.MediaFrame.Post ) - return new media.view.MediaFrame.Post( attributes ).render().attach().open(); + var MediaFrame = media.view.MediaFrame, + frame; + + if ( ! MediaFrame ) + return; + + attributes = _.defaults( attributes || {}, { + frame: 'select' + }); + + if ( 'select' === attributes.frame && MediaFrame.Select ) + frame = new MediaFrame.Select( attributes ); + else if ( 'post' === attributes.frame && MediaFrame.Post ) + frame = new MediaFrame.Post( attributes ); + + delete attributes.frame; + return frame.render().attach().open(); }; _.extend( media, { model: {}, view: {}, controller: {} });