Media: When the attachment details view changes to another view or attachment, save compat fields on destroy. (We already do this for non-compat fields.) props koopersmith. fixes #22776.
git-svn-id: https://develop.svn.wordpress.org/trunk@23098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
affd3a9a98
commit
b186d63721
@ -4080,6 +4080,13 @@
|
|||||||
this.model.on( 'change:compat', this.render, this );
|
this.model.on( 'change:compat', this.render, this );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dispose: function() {
|
||||||
|
if ( this.$(':focus').length )
|
||||||
|
this.save();
|
||||||
|
|
||||||
|
return media.View.prototype.dispose.apply( this, arguments );
|
||||||
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var compat = this.model.get('compat');
|
var compat = this.model.get('compat');
|
||||||
if ( ! compat || ! compat.item )
|
if ( ! compat || ! compat.item )
|
||||||
@ -4100,7 +4107,8 @@
|
|||||||
save: function( event ) {
|
save: function( event ) {
|
||||||
var data = {};
|
var data = {};
|
||||||
|
|
||||||
event.preventDefault();
|
if ( event )
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
_.each( this.$el.serializeArray(), function( pair ) {
|
_.each( this.$el.serializeArray(), function( pair ) {
|
||||||
data[ pair.name ] = pair.value;
|
data[ pair.name ] = pair.value;
|
||||||
|
Loading…
Reference in New Issue
Block a user