Opened 10 years ago

Last modified 6 years ago

#8666 confirmed Bug

Wrong rowspan after vertically splitting and merging back cells

Reported by: nitesh Owned by:
Priority: Normal Milestone:
Component: Core : Tables Version: 3.1
Keywords: Oracle Cc:

Description (last modified by Jakub Ś)

Add a table using the default options:

<table border="1" cellpadding="1" cellspacing="1" style="width: 500px">
	<tbody>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
	</tbody>
</table>
<p>
	&nbsp;</p>

The split the first cell vertically (starting from CKEditor 4.5.0 Horizontally - #8024):

<table border="1" cellpadding="1" cellspacing="1" style="width: 500px">
	<tbody>
		<tr>
			<td>
				&nbsp;</td>
			<td rowspan="2">
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
	</tbody>
</table>
<p>
	&nbsp;</p>

Then merge the first cell down:

<table border="1" cellpadding="1" cellspacing="1" style="width: 500px">
	<tbody>
		<tr>
			<td rowspan="2">
				&nbsp;</td>
			<td rowspan="2">
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
		<tr>
			<td>
				&nbsp;</td>
			<td>
				&nbsp;</td>
		</tr>
	</tbody>
</table>
<p>
	&nbsp;</p>

It should revert to the original layout, i.e. the first set of html pasted, but instead the first row ends up with four table cells, and the second row ends up with just two.

Change History (8)

comment:1 Changed 10 years ago by Jakub Ś

Description: modified (diff)

comment:2 Changed 10 years ago by Jakub Ś

Status: newconfirmed
Version: 3.6.23.1

Issue has been reproducible from CKEditor 3.1

Related tickets are: #6111, #8177

comment:3 Changed 10 years ago by Jakub Ś

In latest CKEditor 3.6.2 there is also extra colspan.

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

comment:4 Changed 10 years ago by nitesh

Component: GeneralCore : Tables

comment:5 Changed 10 years ago by nitesh

Would anyone be able to advise what the ETA is on this to be assigned?

comment:6 Changed 10 years ago by Jakub Ś

#9033 was marked as duplicate

Proposed fix from #9033:

This bug is in "tabletools/plugin.js", mergeCells function. After removing an empty tailTr, all cells in the previous row should be updated with new rowSpan.

My fix:

var newmap = null;
			for ( i = count - 1; i >= 0; i-- )
			{
				var tailTr = trs.getItem( i );
				if ( !tailTr.$.cells.length )
				{
					tailTr.remove(); \\
					if (i>0){
						if (!newmap){
							newmap = CKEDITOR.tools.buildTableMap(table );
						}
						
						var cells = cellInRow(newmap, i-1);
						for (var j = 0;j < cells.length;j++){
							if (cells[j].rowSpan>1){								
							cells[j].rowSpan = cells[j].rowSpan-1;
							}
						}
					}
					count++;
					continue;
				}
			}

comment:7 Changed 10 years ago by nitesh

Hi there, I have looked at this fix that j.swiderski kindly posted, and it seems to work. Could someone from the dev team verify and integrate it if possible?

comment:8 Changed 6 years ago by Jakub Ś

Description: modified (diff)
Keywords: Oracle added
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy