[wp-trac] [WordPress Trac] #40911: Replacing an image in the text editor causes text below to get deleted

WordPress Trac noreply at wordpress.org
Fri Jun 2 16:24:27 UTC 2017

#40911: Replacing an image in the text editor causes text below to get deleted
 Reporter:  jpenningroth  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  4.7.5
 Severity:  normal        |   Keywords:
  Focuses:                |
 We've run into the following problem when editing a post using the text
 editor: if you have an image inserted with paragraphs of text below it and
 you go back to try to remove and replace the image, text below is getting

 Here are the steps to recreate this problem:
 1. Select the image code
 2. Delete the image
 3. Hit "Add Media" to add in a new image
 4. When the image is inserted, you can see that the first few lines of
 copy below it are getting deleted, and the remaining copy is getting
 shifted up so that it's on the same line as the image code.

 We were also able to reproduce this issue on a fresh install of WordPress.
 It seems this does only occur in a specific edge case, though:
 1. When using the editor in the "Text" tab
 2. Deleting an existing image (and caption)
 3. Not creating a new line
 3. Inserting an image

 We're able to avoid this by doing either of the following workarounds:
 - Only adding and removing images in the "Visual" tab of the editor
 - If using the "Text" tab, first create a new line after deleting the
 image, return to the previous line and insert image.

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

More information about the wp-trac mailing list