Skip to content
This repository has been archived by the owner on Aug 24, 2018. It is now read-only.

Commit

Permalink
Remove disabling of syncing attachment changes to server so captions …
Browse files Browse the repository at this point in the history
…can be modified
  • Loading branch information
westonruter committed Sep 16, 2017
1 parent 775f498 commit e5ee972
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions wp-admin/js/widgets/media-gallery-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
* @returns {void}
*/
editMedia: function editMedia() {
var control = this, selection, mediaFrame, defaultSync, mediaFrameProps;
var control = this, selection, mediaFrame, mediaFrameProps;
selection = new wp.media.model.Selection( control.selectedAttachments.models, {
multiple: true
});
Expand Down Expand Up @@ -265,19 +265,6 @@
} );
} );

// 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( 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;
});

mediaFrame.$el.addClass( 'media-widget' );
mediaFrame.open();

Expand All @@ -292,7 +279,7 @@
* @returns {void}
*/
selectMedia: function selectMedia() {
var control = this, selection, mediaFrame, defaultSync, mediaFrameProps;
var control = this, selection, mediaFrame, mediaFrameProps;
selection = new wp.media.model.Selection( control.selectedAttachments.models, {
multiple: true
});
Expand Down Expand Up @@ -336,20 +323,6 @@
} );
} );

// @todo The following needs to be updated in MediaWidgetControl#selectMedia in core, where it was missed in r41248.
// 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( 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;
});

mediaFrame.$el.addClass( 'media-widget' );
mediaFrame.open();

Expand Down

0 comments on commit e5ee972

Please sign in to comment.