+ return wp.media.post( 'save-attachment-compat', _.defaults({
+ id: this.id,
+ nonce: this.get('nonces').update,
+ post_id: wp.media.model.settings.post.id
+ }, data ) ).done( function( resp, status, xhr ) {
+ model.set( model.parse( resp, xhr ), options );
+ });
+ }
+}, {
+ /**
+ * Create a new model on the static 'all' attachments collection and return it.
+ *
+ * @static
+ * @param {Object} attrs
+ * @returns {wp.media.model.Attachment}
+ */
+ create: function( attrs ) {
+ var Attachments = wp.media.model.Attachments;
+ return Attachments.all.push( attrs );
+ },
+ /**
+ * Create a new model on the static 'all' attachments collection and return it.
+ *
+ * If this function has already been called for the id,
+ * it returns the specified attachment.
+ *
+ * @static
+ * @param {string} id A string used to identify a model.
+ * @param {Backbone.Model|undefined} attachment
+ * @returns {wp.media.model.Attachment}
+ */
+ get: _.memoize( function( id, attachment ) {
+ var Attachments = wp.media.model.Attachments;
+ return Attachments.all.push( attachment || { id: id } );
+ })
+});
+
+module.exports = Attachment;
+
+},{}],3:[function(require,module,exports){
+/**
+ * wp.media.model.Attachments
+ *
+ * A collection of attachments.
+ *
+ * This collection has no persistence with the server without supplying
+ * 'options.props.query = true', which will mirror the collection
+ * to an Attachments Query collection - @see wp.media.model.Attachments.mirror().
+ *
+ * @class
+ * @augments Backbone.Collection
+ *
+ * @param {array} [models] Models to initialize with the collection.
+ * @param {object} [options] Options hash for the collection.
+ * @param {string} [options.props] Options hash for the initial query properties.
+ * @param {string} [options.props.order] Initial order (ASC or DESC) for the collection.
+ * @param {string} [options.props.orderby] Initial attribute key to order the collection by.
+ * @param {string} [options.props.query] Whether the collection is linked to an attachments query.
+ * @param {string} [options.observe]
+ * @param {string} [options.filters]
+ *
+ */
+var Attachments = Backbone.Collection.extend({
+ /**
+ * @type {wp.media.model.Attachment}
+ */
+ model: wp.media.model.Attachment,