[wp-trac] [WordPress Trac] #38192: Linking directly into Edit Image mode breaks cropping; imageEdit.init not triggered.

WordPress Trac noreply at wordpress.org
Thu Sep 29 20:49:30 UTC 2016


#38192: Linking directly into Edit Image mode breaks cropping; imageEdit.init not
triggered.
--------------------------+-----------------------------
 Reporter:  dougwollison  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  4.6.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I've noticed for a while that when jumping directly into Edit Image mode
 on an attachment (namely when clicking the "Edit Image" link for an
 attachment inside the Media Manager), trying to crop the image doesn't
 work.

 To reproduce, simply visit the edit link for any attachment with "&image-
 editor" tacked onto the URL. (e.g. /wp-admin/post.php?post=123&action=edit
 &image-editor)

 When you drag to create the crop box, the Selection values keep saying
 NaN, and so trying to confirm your selection won't do anything, not even
 give you a visible error.

 Currently, the only solution when when this occurs is to click cancel,
 then the Edit Image button on the screen there, where it properly
 initializes.

 After some debugging in wp-admin/js/image-edit.js, I found the cause was
 that imageEdit.hold.sizer was undefined, which is set by imageEdit.init().
 This method is called when the Edit Image button is clicked manually, but
 it never get's called on page load when it's triggered automatically.

 Not entirely sure where the call should go, but that should be the only
 adjustment needed to make it work.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38192>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list