Ticket #8813 (confirmed Bug)

Opened 2 years ago

Last modified 2 years ago

Cell width is not updated when cells are merged

Reported by: tmonahan Owned by:
Priority: Normal Milestone:
Component: Core : Tables Version: 3.1
Keywords: IBM Cc: damo, satya

Description

To Reproduce:

  • Copy the following table into Source view. This is just a standard table with widths applied to all cells in the first row:
<table border="1" cellpadding="1" cellspacing="1" style="width: 400px;">
	<tbody>
		<tr>
			<td style="width: 100px;">
				&nbsp;</td>
			<td style="width: 100px;">
				&nbsp;</td>
			<td style="width: 100px;">
				&nbsp;</td>
			<td style="width: 100px;">
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
	</tbody>
</table>
  • Switch to wysiwyg mode and select any 2 cells in row 1. Right click and select Cell -> Merge Cells.
  • Switch to source view to see the HTML markup for the table.

Problem: The cell that was merged still has a width of 100px. It should now have a width of 200px i.e. the sum of the widths of the merged cells.

<table border="1" cellpadding="1" cellspacing="1" style="width: 400px;">
	<tbody>
		<tr>
			<td colspan="2" rowspan="1" style="width: 100px;">
				&nbsp;</td>
			<td style="width: 100px;">
				&nbsp;</td>
			<td style="width: 100px;">
				&nbsp;</td>
		</tr>
		......
	</tbody>
</table>

Cell widths should also be updated when merged using the Cell -> Merge Right option.

Change History

comment:1 Changed 2 years ago by tmonahan

  • Summary changed from Cell width is not updated when cell are merged to Cell width is not updated when cells are merged

comment:2 Changed 2 years ago by j.swiderski

  • Status changed from new to confirmed
  • Version changed from 3.6.3 (SVN - trunk) to 3.1

Reproducible from CKEditor 3.1

IMO the safest option would be changing the width only if two merged cells have this attribute present. In other cases when only one cell has width E.g set to 100px I would leave it the same after merging.

Sure that if you have E.g Table -> 400px and cells -> 100, no width, 50, 150 you can calculate the remaining size and add it to merged cell but what if you have Table -> 400px and cells -> 100px, none, 300px, 300px (it's possible)? In this case you would endup with -300px (400-700). Again sure that you can be smart and not add width if it is below 0 but what if for some reason user wanted to leave size of merged cell to 100px ?

Perhaps a better general overview of how merging widths should work is needed.

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