mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 16:21:26 +01:00
Customize: Prevent attachment deletions from silently failing in media modals opened for Media widgets.
Amends [40640]. See #32417. Fixes #41609. Built from https://develop.svn.wordpress.org/trunk@41248 git-svn-id: http://core.svn.wordpress.org/trunk@41088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e956aa4176
commit
5c755f652b
@ -708,10 +708,14 @@ wp.mediaWidgets = ( function( $ ) {
|
||||
control.model.set( control.getModelPropsFromMediaFrame( mediaFrame ) );
|
||||
});
|
||||
|
||||
// Disable syncing of attachment changes back to server. See <https://core.trac.wordpress.org/ticket/40403>.
|
||||
// Disable syncing of attachment changes back to server (except for deletions). See <https://core.trac.wordpress.org/ticket/40403>.
|
||||
defaultSync = wp.media.model.Attachment.prototype.sync;
|
||||
wp.media.model.Attachment.prototype.sync = function rejectedSync() {
|
||||
return $.Deferred().rejectWith( this ).promise();
|
||||
wp.media.model.Attachment.prototype.sync = function( method ) {
|
||||
if ( 'delete' === method ) {
|
||||
return defaultSync.apply( this, arguments );
|
||||
} else {
|
||||
return $.Deferred().rejectWith( this ).promise();
|
||||
}
|
||||
};
|
||||
mediaFrame.on( 'close', function onClose() {
|
||||
wp.media.model.Attachment.prototype.sync = defaultSync;
|
||||
|
2
wp-admin/js/widgets/media-widgets.min.js
vendored
2
wp-admin/js/widgets/media-widgets.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-alpha-41247';
|
||||
$wp_version = '4.9-alpha-41248';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user