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. Built from https://develop.svn.wordpress.org/trunk@60031 git-svn-id: http://core.svn.wordpress.org/trunk@59367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -4970,7 +4970,7 @@ Post = Select.extend(/** @lends wp.media.view.MediaFrame.Post.prototype */{
|
|||||||
style: 'primary',
|
style: 'primary',
|
||||||
text: editing ? l10n.updateGallery : l10n.insertGallery,
|
text: editing ? l10n.updateGallery : l10n.insertGallery,
|
||||||
priority: 80,
|
priority: 80,
|
||||||
requires: { library: true },
|
requires: { library: true, uploadingComplete: true },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fires wp.media.controller.State#update
|
* @fires wp.media.controller.State#update
|
||||||
@@ -5642,7 +5642,8 @@ Toolbar = View.extend(/** @lends wp.media.view.Toolbar.prototype */{
|
|||||||
}
|
}
|
||||||
|
|
||||||
var requires = button.options.requires,
|
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.
|
// Prevent insertion of attachments if any of them are still uploading.
|
||||||
if ( selection && selection.models ) {
|
if ( selection && selection.models ) {
|
||||||
@@ -5650,6 +5651,9 @@ Toolbar = View.extend(/** @lends wp.media.view.Toolbar.prototype */{
|
|||||||
return attachment.get('uploading') === true;
|
return attachment.get('uploading') === true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if ( requires.uploadingComplete && modelsUploading ) {
|
||||||
|
disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( requires.selection && selection && ! selection.length ) {
|
if ( requires.selection && selection && ! selection.length ) {
|
||||||
disabled = true;
|
disabled = true;
|
||||||
|
|||||||
2
wp-includes/js/media-views.min.js
vendored
2
wp-includes/js/media-views.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.8-beta2-60030';
|
$wp_version = '6.8-beta2-60031';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|||||||
Reference in New Issue
Block a user