Opened 5 years ago

Last modified 4 years ago

#12778 confirmed Bug

Cannot delete paragraph before and after a widget

Reported by: Wiktor Walc Owned by:
Priority: Normal Milestone:
Component: General Version: 4.3 Beta
Keywords: Support Cc:

Description (last modified by Piotrek Koszuliński)

Found in Chrome, confirmed also on Firefox.

  1. Create a table
  2. Insert a widget (e.g. Enhanced Image) in a table cell (note: it works only in CKEditor 4.4.1+ #11798)
  3. See that below widget an empty paragraph is created. If this additional space is disturbing for somebody, one cannot remove it.

This issue can also be reproduced directly in body: http://stackoverflow.com/questions/30262191/ckeditor-how-to-delete-empty-paragraphs-before-and-between-widgets

To reproduce try this code:

<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
	<tbody>
		<tr>
			<td>&nbsp;</td>
			<td>
			<figure class="image"><img alt="dfgdfg" height="480" src="assets/image1.jpg" width="377" />
			<figcaption>Caption</figcaption>
			</figure>

			<p>&nbsp;</p>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
		</tr>
	</tbody>
</table>

There is one interesting method to actually remove the element. But this is so counter-intuitive that it should not be considered as a correct solution.

  1. Put the cursor in the <p> element that you want to removed

  1. Select p in elements path (see that additional br showed up in the elements path automatically)

  1. Press Backspace. Now the paragraph is gone (although slightly different visual result is in Chrome and Firefox).

Attachments (3)

widget_table.png (78.8 KB) - added by Wiktor Walc 5 years ago.
cursor_in_p.png (13.3 KB) - added by Wiktor Walc 5 years ago.
p_bogus_br.png (8.5 KB) - added by Wiktor Walc 5 years ago.

Download all attachments as: .zip

Change History (10)

Changed 5 years ago by Wiktor Walc

Attachment: widget_table.png added

comment:1 Changed 5 years ago by Wiktor Walc

Description: modified (diff)
Status: newconfirmed

Changed 5 years ago by Wiktor Walc

Attachment: cursor_in_p.png added

Changed 5 years ago by Wiktor Walc

Attachment: p_bogus_br.png added

comment:2 Changed 5 years ago by Wiktor Walc

Description: modified (diff)
Keywords: Support added

comment:3 Changed 5 years ago by Niklas

I cannot delete the first <p>&nbsp;</p> if it's followed by <figure>. I tried this with Chrome.

<p>&nbsp;</p>

<figure class="align-left"><img class="img-responsive img-rounded" src="//placehold.it/100" /></figure>

<p>Lorem ipsum!</p>

comment:4 Changed 4 years ago by Piotrek Koszuliński

Description: modified (diff)
Summary: Cannot delete a paragraph inside the table if widget is inside a table cellCannot delete paragraph before and after a widget
Version: 4.3 Beta

comment:5 Changed 4 years ago by Piotrek Koszuliński

This would require some additional rules for delete and backspace, so if the current paragraph is already empty they should remove it instead of focusing widget. This code could land e.g. here: https://github.com/ckeditor/ckeditor-dev/blob/3a10930/core/selection.js#L339-L365.

comment:6 Changed 4 years ago by Piotrek Koszuliński

If anyone wants to contribute a patch, then:

comment:7 Changed 4 years ago by Jakub Ś

#13864 was marked as duplicate.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy