Media Grid: don't blow away the Attachment Details modal every time a new model is loaded.
Props ericlewis. Fixes #29104. Built from https://develop.svn.wordpress.org/trunk@29368 git-svn-id: http://core.svn.wordpress.org/trunk@29146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
696c12bc55
commit
27890cc734
|
@ -478,18 +478,17 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Close this modal and immediately open another one.
|
||||
*
|
||||
* Allows for quickly swapping out the attachment being edited.
|
||||
* Rerender the view.
|
||||
*/
|
||||
resetContent: function() {
|
||||
this.modal.close();
|
||||
wp.media( {
|
||||
frame: 'edit-attachments',
|
||||
gridRouter: this.gridRouter,
|
||||
library: this.library,
|
||||
model: this.model
|
||||
} );
|
||||
rerender: function() {
|
||||
// Only rerender the `content` region.
|
||||
if ( this.content.mode() !== 'edit-metadata' ) {
|
||||
this.content.mode( 'edit-metadata' );
|
||||
} else {
|
||||
this.content.render();
|
||||
}
|
||||
this.$('.left').toggleClass( 'disabled', ! this.hasPrevious() );
|
||||
this.$('.right').toggleClass( 'disabled', ! this.hasNext() );
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -500,7 +499,8 @@
|
|||
return;
|
||||
}
|
||||
this.model = this.library.at( this.getCurrentIndex() - 1 );
|
||||
this.resetContent();
|
||||
|
||||
this.rerender();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -511,7 +511,8 @@
|
|||
return;
|
||||
}
|
||||
this.model = this.library.at( this.getCurrentIndex() + 1 );
|
||||
this.resetContent();
|
||||
|
||||
this.rerender();
|
||||
},
|
||||
|
||||
getCurrentIndex: function() {
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue