[wp-trac] [WordPress Trac] #28272: Image looses link after drag and drop

WordPress Trac noreply at wordpress.org
Mon Jun 16 00:56:06 UTC 2014


#28272: Image looses link after drag and drop
--------------------------+------------------------------
 Reporter:  avryl         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  TinyMCE       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by azaozz):

 Replying to [comment:1 afercia]:
 > About dragging, when you click a linked image, TinyMce shows you the
 current selection in the statusbar "path" as:
 > p » a » img
 > so you're actually selecting the image element and when you drag, you
 drag the img element.
 > The only way I'm aware of to drag the linked image together with its
 link, is to actually select the a element so just click the "a" in the
 TinyMCE statusbar path, and it will change to:
 > p » a
 > drag now to another paragraph and linked image will be moved correctly.

 Yep, this is the proper way to drag an image wrapped in a link. However it
 is too complex for most users. We will need to make it work automatically.
 Perhaps something like:

 - On `dragstart` check if image is selected, check if parentNode is a link
 with no other children, store ref to it.
 - On `dragend` check if the image was actually moved in the dom, move the
 old parentNode (link) to the new location and append the image in it.

 In theory the same approach should work for dragging images with captions.
 Big plus is that both `dragstart` and `dragend` are not fired when
 dragging a file from the OS into the browser window.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28272#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list