Opened 12 years ago

Closed 12 years ago

#9037 closed Bug (duplicate)

[table] Horizontal split cell [2,1], then vertical split cell [1,2], table becomes messy

Reported by: tengshengbo Owned by:
Priority: Normal Milestone:
Component: Core : Tables Version: 3.6.3
Keywords: Cc:

Description (last modified by Jakub Ś)

steps:

  1. create a 3x3 table
  2. horizontal split the first cell in the second row
  3. vertical split the second cell in the first row,

Defect:
the table becomes messy.

This bug is in "verticalSplitCell" function. When figuring out where to insert the new cell by checking the virtual row, the index is wrong. My fix:

var currentIndex = 0;
// Figure out where to insert the new cell by checking the vitual row.
			for ( var c = 0; c < newCellRow.length; c++ )
			{
				candidateCell = newCellRow[ c ];
				// Catch first cell actually following the column.
				if ( candidateCell.parentNode == newCellTr.$
					&& currentIndex > colIndex )
				{
					var candidateCKCell =  new CKEDITOR.dom.element( candidateCell ) ;
					newCell.insertBefore(candidateCKCell);
					
					break;
				}
				else{
					if (candidateCell.colSpan>1){
						currentIndex  = currentIndex + candidateCell.colSpan;
					}else{
						currentIndex  = currentIndex + 1;
					}
					
					candidateCell = null;
				}
					
				
			}

Change History (3)

comment:1 Changed 12 years ago by tengshengbo

var currentIndex = 0;
			
			for ( var c = 0; c < newCellRow.length; c++ )
			{
				candidateCell = newCellRow[ c ];
				if ( candidateCell.parentNode == newCellTr.$
					&& currentIndex > colIndex )
				{
					var candidateCKCell =  new CKEDITOR.dom.element( candidateCell ) ;
					newCell.insertBefore(candidateCKCell);
					break;
				}
				else{
					if (candidateCell.colSpan>1){
						currentIndex  = currentIndex + candidateCell.colSpan;
					}else{
						currentIndex  = currentIndex + 1;
					}
					
					candidateCell = null;
				}
					
				
			}
Last edited 12 years ago by Jakub Ś (previous) (diff)

comment:2 Changed 12 years ago by Jakub Ś

Description: modified (diff)

comment:3 Changed 12 years ago by Jakub Ś

Resolution: duplicate
Status: newclosed

This TC looks like a duplicate of #8177

@tengshengbo I have copied your proposed fix to #8177.

NOTE: @tengshengbo if you don't think that this ticket is a duplicate of #8177 please send me a comment.

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