+ if ( isURL ) {
+ props.url = data.replace(/<[^>]+>/g, '');
+ } else {
+ shortcode = wp.shortcode.next( 'embed', data ).shortcode;
+
+ props = _.defaults( shortcode.attrs.named, this.defaults );
+ if ( shortcode.content ) {
+ props.url = shortcode.content;
+ }
+ }
+
+ frame = wp.media({
+ frame: 'post',
+ state: 'embed',
+ metadata: props
+ });
+
+ return frame;
+ },
+
+ shortcode : function( model ) {
+ var self = this, content;
+
+ _.each( this.defaults, function( value, key ) {
+ model[ key ] = self.coerce( model, key );
+
+ if ( value === model[ key ] ) {
+ delete model[ key ];
+ }
+ });
+
+ content = model.url;
+ delete model.url;
+
+ return new wp.shortcode({
+ tag: 'embed',
+ attrs: model,
+ content: content
+ });
+ }
+ };
+
+ wp.media.collection = function(attributes) {
+ var collections = {};
+
+ return _.extend( {
+ coerce : wp.media.coerce,
+ /**
+ * Retrieve attachments based on the properties of the passed shortcode
+ *
+ * @global wp.media.query
+ *
+ * @param {wp.shortcode} shortcode An instance of wp.shortcode().
+ * @returns {wp.media.model.Attachments} A Backbone.Collection containing
+ * the media items belonging to a collection.
+ * The query[ this.tag ] property is a Backbone.Model
+ * containing the 'props' for the collection.
+ */