Media: Adds Edit Image controller to Media Library select frame.

This adds the necessary state for `EditImage` views in the `select` frame and listeners for setting that view.

Props fblaser, w3rkjana, afercia, antpb.
See #48028.


git-svn-id: https://develop.svn.wordpress.org/trunk@46461 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Anthony Burchell 2019-10-11 20:41:51 +00:00
parent 42493b7ed8
commit dcb037fc3a

View File

@ -58,6 +58,16 @@ Select = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Select.prototype
};
},
editImageContent: function() {
var image = this.state().get('image'),
view = new wp.media.view.EditImage( { model: image, controller: this } ).render();
this.content.set( view );
// after creating the wrapper view, load the actual editor via an ajax call
view.loadEditor();
},
/**
* Create the default states on the frame.
*/
@ -76,7 +86,8 @@ Select = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Select.prototype
multiple: options.multiple,
title: options.title,
priority: 20
})
}),
new wp.media.controller.EditImage( { model: options.editImage } )
]);
},
@ -91,6 +102,7 @@ Select = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.Select.prototype
this.on( 'content:create:browse', this.browseContent, this );
this.on( 'content:render:upload', this.uploadContent, this );
this.on( 'toolbar:create:select', this.createSelectToolbar, this );
this.on( 'content:render:edit-image', this.editImageContent, this );
},
/**