blob: 1f0fe744673ab512c6d4734672f05b67824b1518 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/**
* wp.media.controller.MediaLibrary
*
* @memberOf wp.media.controller
*
* @class
* @augments wp.media.controller.Library
* @augments wp.media.controller.State
* @augments Backbone.Model
*/
var Library = wp.media.controller.Library,
MediaLibrary;
MediaLibrary = Library.extend(/** @lends wp.media.controller.MediaLibrary.prototype */{
defaults: _.defaults({
// Attachments browser defaults. @see media.view.AttachmentsBrowser
filterable: 'uploaded',
displaySettings: false,
priority: 80,
syncSelection: false
}, Library.prototype.defaults ),
/**
* @since 3.9.0
*
* @param options
*/
initialize: function( options ) {
this.media = options.media;
this.type = options.type;
this.set( 'library', wp.media.query({ type: this.type }) );
Library.prototype.initialize.apply( this, arguments );
},
/**
* @since 3.9.0
*/
activate: function() {
// @todo this should use this.frame.
if ( wp.media.frame.lastMime ) {
this.set( 'library', wp.media.query({ type: wp.media.frame.lastMime }) );
delete wp.media.frame.lastMime;
}
Library.prototype.activate.apply( this, arguments );
}
});
module.exports = MediaLibrary;
|