mirror of
git://develop.git.wordpress.org/
synced 2025-03-24 05:49:49 +01:00
Media: disable "Insert Gallery" button during uploads.
Ensure that the button to insert a gallery is disabled until all image uploads have completed on the Edit Gallery screen. Prevents an issue where users could insert a gallery with some images missing. Props: adamsilverstein, gonom9, rishavdutta. Fixes: #39824. git-svn-id: https://develop.svn.wordpress.org/trunk@60031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6f9d8e6c69
commit
4a12552742
@ -580,7 +580,7 @@ Post = Select.extend(/** @lends wp.media.view.MediaFrame.Post.prototype */{
|
||||
style: 'primary',
|
||||
text: editing ? l10n.updateGallery : l10n.insertGallery,
|
||||
priority: 80,
|
||||
requires: { library: true },
|
||||
requires: { library: true, uploadingComplete: true },
|
||||
|
||||
/**
|
||||
* @fires wp.media.controller.State#update
|
||||
|
@ -143,7 +143,8 @@ Toolbar = View.extend(/** @lends wp.media.view.Toolbar.prototype */{
|
||||
}
|
||||
|
||||
var requires = button.options.requires,
|
||||
disabled = false;
|
||||
disabled = false,
|
||||
modelsUploading = ! _.isEmpty( library.findWhere( { 'uploading': true } ) );
|
||||
|
||||
// Prevent insertion of attachments if any of them are still uploading.
|
||||
if ( selection && selection.models ) {
|
||||
@ -151,6 +152,9 @@ Toolbar = View.extend(/** @lends wp.media.view.Toolbar.prototype */{
|
||||
return attachment.get('uploading') === true;
|
||||
});
|
||||
}
|
||||
if ( requires.uploadingComplete && modelsUploading ) {
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
if ( requires.selection && selection && ! selection.length ) {
|
||||
disabled = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user