Make WordPress Core

Changeset 40020


Ignore:
Timestamp:
01/27/2017 06:29:48 PM (8 years ago)
Author:
adamsilverstein
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/image-edit.js

    r39740 r40020  
    573573    imgLoaded : function(postid) {
    574574        var img = $('#image-preview-' + postid), parent = $('#imgedit-crop-' + postid);
     575
     576        // Ensure init has run even when directly loaded.
     577        if ( 'undefined' === typeof this.hold.sizer ) {
     578            this.init( postid );
     579        }
    575580
    576581        this.initCrop(postid, img, parent);
Note: See TracChangeset for help on using the changeset viewer.