mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Media: ensure JavaScript initialized when media edit screen is loaded directly.
Fix a JavaScript error when the media edit screen is loaded directly via a url such as `/wp-admin/post.php?post={post_id}&action=edit&image-editor`. Add a check in `imgLoaded` for `this.hold.sizer` which is set up during initialization and required for the cropping tool. Call `init` if this is undefined.
Props NoseGraze.
Fixes #38138.
git-svn-id: https://develop.svn.wordpress.org/trunk@40020 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1a068f2a61
commit
856416049d
@ -573,6 +573,11 @@
|
||||
imgLoaded : function(postid) {
|
||||
var img = $('#image-preview-' + postid), parent = $('#imgedit-crop-' + postid);
|
||||
|
||||
// Ensure init has run even when directly loaded.
|
||||
if ( 'undefined' === typeof this.hold.sizer ) {
|
||||
this.init( postid );
|
||||
}
|
||||
|
||||
this.initCrop(postid, img, parent);
|
||||
this.setCropSelection(postid, 0);
|
||||
this.toggleEditor(postid, 0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user