Media: Grid view - correct placeholder positioning during uploads.
Preventing contextually created attachments from being added to the grid collection in Attachments.validator. Remove the previous filtering introduced in [41937] which caused the placement issue. Merge of [42739-42740] to the 4.9 branch. Props lancewillett, Junaidkbr, designsimply, joemcgill. Fixes #42968. Built from https://develop.svn.wordpress.org/branches/4.9@42848 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
058176bc28
commit
276dbdc296
|
@ -642,6 +642,15 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen
|
|||
* @returns {Boolean}
|
||||
*/
|
||||
validator: function( attachment ) {
|
||||
|
||||
// Filter out contextually created attachments (e.g. headers, logos, etc.).
|
||||
if (
|
||||
! _.isUndefined( attachment.attributes.context ) &&
|
||||
'' !== attachment.attributes.context
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! this.validateDestroyed && attachment.destroyed ) {
|
||||
return false;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -953,9 +953,6 @@ Library = wp.media.controller.State.extend(/** @lends wp.media.controller.Librar
|
|||
}) );
|
||||
}
|
||||
|
||||
this._filterContext();
|
||||
this.get('library').on( 'add', this._filterContext, this );
|
||||
|
||||
this.resetDisplays();
|
||||
},
|
||||
|
||||
|
@ -1155,20 +1152,8 @@ Library = wp.media.controller.State.extend(/** @lends wp.media.controller.Librar
|
|||
if ( view && view.get( mode ) ) {
|
||||
setUserSetting( 'libraryContent', mode );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter out contextually created attachments (e.g. headers, logos, etc.)
|
||||
*
|
||||
* @since 4.9.0
|
||||
*/
|
||||
_filterContext: function() {
|
||||
var library = this.get('library');
|
||||
|
||||
library.set( library.filter( function( item ) {
|
||||
return item.get('context') === '';
|
||||
} ) );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Make selectionSync available on any Media Library state.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9.5-alpha-42847';
|
||||
$wp_version = '4.9.5-alpha-42848';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue