Avoid JS errors when edit image is not available, such as outside of post editing.

props gcorne.
fixes #27551.

Built from https://develop.svn.wordpress.org/trunk@27787


git-svn-id: http://core.svn.wordpress.org/trunk@27623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-27 18:15:15 +00:00
parent bd0df204a1
commit e1be2d21d8
2 changed files with 5 additions and 5 deletions

View File

@ -5663,8 +5663,8 @@
* @param {Object} event * @param {Object} event
*/ */
editAttachment: function( event ) { editAttachment: function( event ) {
var editState = this.controller.state( 'edit-image' ); var editState = this.controller.states.get( 'edit-image' );
if ( window.imageEdit ) { if ( window.imageEdit && editState ) {
event.preventDefault(); event.preventDefault();
editState.set( 'image', this.model ); editState.set( 'image', this.model );
@ -6021,9 +6021,9 @@
}, },
editAttachment: function( event ) { editAttachment: function( event ) {
var editState = this.controller.state( 'edit-image' ); var editState = this.controller.states.get( 'edit-image' );
if ( window.imageEdit ) { if ( window.imageEdit && editState ) {
event.preventDefault(); event.preventDefault();
editState.set( 'image', this.model.attachment ); editState.set( 'image', this.model.attachment );
this.controller.setState( 'edit-image' ); this.controller.setState( 'edit-image' );

File diff suppressed because one or more lines are too long