git-svn-id: http://core.svn.wordpress.org/trunk@22713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6fb316b1fb
commit
e25565f4b7
|
@ -320,6 +320,15 @@ var tb_position;
|
|||
|
||||
selection.gallery = attachments.gallery;
|
||||
|
||||
// Fetch the query's attachments, and then break ties from the
|
||||
// query to allow for sorting.
|
||||
selection.more().done( function() {
|
||||
// Break ties with the query.
|
||||
selection.props.set({ query: false });
|
||||
selection.unmirror();
|
||||
selection.props.unset('orderby');
|
||||
});
|
||||
|
||||
return wp.media({
|
||||
frame: 'post',
|
||||
state: 'gallery-edit',
|
||||
|
|
|
@ -2540,6 +2540,7 @@
|
|||
this.scroll = _.chain( this.scroll ).bind( this ).throttle( this.options.refreshSensitivity ).value();
|
||||
|
||||
this.initSortable();
|
||||
this.collection.props.on( 'change:orderby', this.refreshSortable, this );
|
||||
|
||||
_.bindAll( this, 'css' );
|
||||
this.model.on( 'change:edge change:gutter', this.css, this );
|
||||
|
@ -2549,6 +2550,7 @@
|
|||
},
|
||||
|
||||
destroy: function() {
|
||||
this.collection.props.off( null, null, this );
|
||||
this.collection.off( 'add remove reset', null, this );
|
||||
this.model.off( 'change:edge change:gutter', this.css, this );
|
||||
$(window).off( 'resize.attachments', this._resizeCss );
|
||||
|
@ -2628,6 +2630,14 @@
|
|||
}, this );
|
||||
},
|
||||
|
||||
refreshSortable: function() {
|
||||
if ( ! this.options.sortable || ! $.fn.sortable )
|
||||
return;
|
||||
|
||||
// If the `collection` has a `comparator`, disable sorting.
|
||||
this.$el.sortable( 'option', 'disabled', !! this.collection.comparator );
|
||||
},
|
||||
|
||||
render: function() {
|
||||
// If there are no elements, load some.
|
||||
if ( ! this.collection.length ) {
|
||||
|
|
Loading…
Reference in New Issue