ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.79k stars 2.48k forks source link

Moving image to another cell modifies the target cell #4952

Closed KarolDawidziuk closed 2 years ago

KarolDawidziuk commented 3 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open source and paste it:
    <table border="1" cellpadding="1" cellspacing="1" style="width:500px">
    <tbody>
        <tr>
            <td><img alt="" src="https://via.placeholder.com/100" /></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
    </tbody>
    </table>
  2. Using drag & drop move the image into another cell.

Expected result

The image was moved properly.

Actual result

Instead of moving the image itself, a new nested table with the image was created in the target. This problem occurred since 4.7.x version.

This problem won't occur when we add an empty space after the image and without clipboard plugin.

https://user-images.githubusercontent.com/18471998/140518462-c9c8f6c2-e5b2-44ce-a2cf-7a432ebc2273.mov

Other details

KarolDawidziuk commented 2 years ago

First thoughts: It's looking like a problem with extractHtmlFromRange() inside CKEDITOR.plugins.clipboard.internalDrop() method.

Besides, it only occurs on the first try, the next d&d works fine.

CKEditorBot commented 2 years ago

Closed in https://github.com/ckeditor/ckeditor4/pull/4997