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.

Props lancewillett, Junaidkbr, designsimply, joemcgill.
Fixes #42968.

Built from https://develop.svn.wordpress.org/trunk@42739


git-svn-id: http://core.svn.wordpress.org/trunk@42569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Adam Silverstein 2018-02-25 16:41:31 +00:00
parent 4d47bfce41
commit da89d20c39
5 changed files with 15 additions and 21 deletions

View File

@ -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

View File

@ -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();
},
@ -1157,18 +1154,6 @@ Library = wp.media.controller.State.extend(/** @lends wp.media.controller.Librar
}
},
/**
* 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

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42738';
$wp_version = '5.0-alpha-42739';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.