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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
antpb 2019-10-11 20:43:03 +00:00
parent ebd52ce048
commit 97356bbd75
3 changed files with 15 additions and 3 deletions

View File

@ -3322,6 +3322,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.
*/
@ -3340,7 +3350,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 } )
]);
},
@ -3355,6 +3366,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 );
},
/**

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-beta3-46460';
$wp_version = '5.3-beta3-46461';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.