diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index cc48126..3d6f963 100644
|
|
|
|
| 1139 | 1139 | menu: false, |
| 1140 | 1140 | toolbar: 'edit-image', |
| 1141 | 1141 | title: l10n.editImage, |
| 1142 | | content: 'edit-image', |
| 1143 | | syncSelection: true |
| | 1142 | content: 'edit-image' |
| 1144 | 1143 | }, |
| 1145 | 1144 | |
| 1146 | 1145 | activate: function() { |
| 1147 | | if ( ! this.get('selection') ) { |
| 1148 | | this.set( 'selection', new media.model.Selection() ); |
| 1149 | | } |
| 1150 | 1146 | this.listenTo( this.frame, 'toolbar:render:edit-image', this.toolbar ); |
| 1151 | | this.syncSelection(); |
| 1152 | 1147 | }, |
| 1153 | 1148 | |
| 1154 | 1149 | deactivate: function() { |
| … |
… |
|
| 1180 | 1175 | } |
| 1181 | 1176 | }); |
| 1182 | 1177 | |
| 1183 | | _.extend( media.controller.EditImage.prototype, media.selectionSync ); |
| 1184 | | |
| 1185 | 1178 | /** |
| 1186 | 1179 | * wp.media.controller.MediaLibrary |
| 1187 | 1180 | * |
| … |
… |
|
| 1980 | 1973 | // Embed states. |
| 1981 | 1974 | new media.controller.Embed(), |
| 1982 | 1975 | |
| 1983 | | new media.controller.EditImage( { selection: options.selection } ), |
| | 1976 | new media.controller.EditImage( { model: options.editImage } ), |
| 1984 | 1977 | |
| 1985 | 1978 | // Gallery states. |
| 1986 | 1979 | new media.controller.CollectionEdit({ |
| … |
… |
|
| 2251 | 2244 | }, |
| 2252 | 2245 | |
| 2253 | 2246 | editImageContent: function() { |
| 2254 | | var selection = this.state().get('selection'), |
| 2255 | | view = new media.view.EditImage( { model: selection.single(), controller: this } ).render(); |
| | 2247 | var image = this.state().get('image'), |
| | 2248 | view = new media.view.EditImage( { model: image, controller: this } ).render(); |
| 2256 | 2249 | |
| 2257 | 2250 | this.content.set( view ); |
| 2258 | 2251 | |
| … |
… |
|
| 2648 | 2641 | |
| 2649 | 2642 | editImageContent: function() { |
| 2650 | 2643 | var state = this.state(), |
| 2651 | | attachment = state.get('image').attachment, |
| 2652 | | model, |
| | 2644 | model = state.get('image'), |
| 2653 | 2645 | view; |
| 2654 | 2646 | |
| 2655 | | if ( ! attachment ) { |
| 2656 | | return; |
| 2657 | | } |
| 2658 | | |
| 2659 | | model = state.get('selection').single(); |
| 2660 | | |
| 2661 | 2647 | if ( ! model ) { |
| 2662 | | model = attachment; |
| | 2648 | return; |
| 2663 | 2649 | } |
| 2664 | 2650 | |
| 2665 | 2651 | view = new media.view.EditImage( { model: model, controller: this } ).render(); |
| … |
… |
|
| 6073 | 6059 | * @param {Object} event |
| 6074 | 6060 | */ |
| 6075 | 6061 | editAttachment: function( event ) { |
| | 6062 | var editState = this.controller.state( 'edit-image' ); |
| 6076 | 6063 | event.preventDefault(); |
| | 6064 | |
| | 6065 | editState.set( 'image', this.model ); |
| 6077 | 6066 | this.controller.setState( 'edit-image' ); |
| 6078 | 6067 | }, |
| 6079 | 6068 | /** |
| … |
… |
|
| 6420 | 6409 | }, |
| 6421 | 6410 | |
| 6422 | 6411 | editAttachment: function( event ) { |
| | 6412 | var editState = this.controller.state( 'edit-image' ); |
| 6423 | 6413 | event.preventDefault(); |
| | 6414 | |
| | 6415 | editState.set( 'image', this.model.attachment ); |
| 6424 | 6416 | this.controller.setState( 'edit-image' ); |
| 6425 | 6417 | } |
| 6426 | 6418 | }); |