Media: in `wp.media.view.Toolbar.refresh()`, check for a selection before iterating over models.
Props chandrapatel. Fixes #39511. git-svn-id: https://develop.svn.wordpress.org/trunk@40050 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4004400047
commit
baff296dfa
|
@ -7724,9 +7724,11 @@ Toolbar = View.extend({
|
|||
disabled = false;
|
||||
|
||||
// Prevent insertion of attachments if any of them are still uploading
|
||||
if ( selection && selection.models ) {
|
||||
disabled = _.some( selection.models, function( attachment ) {
|
||||
return attachment.get('uploading') === true;
|
||||
});
|
||||
}
|
||||
|
||||
if ( requires.selection && selection && ! selection.length ) {
|
||||
disabled = true;
|
||||
|
|
|
@ -141,9 +141,11 @@ Toolbar = View.extend({
|
|||
disabled = false;
|
||||
|
||||
// Prevent insertion of attachments if any of them are still uploading
|
||||
if ( selection && selection.models ) {
|
||||
disabled = _.some( selection.models, function( attachment ) {
|
||||
return attachment.get('uploading') === true;
|
||||
});
|
||||
}
|
||||
|
||||
if ( requires.selection && selection && ! selection.length ) {
|
||||
disabled = true;
|
||||
|
|
Loading…
Reference in New Issue