Opened 13 years ago
Closed 13 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 )
steps:
- create a 3x3 table
- horizontal split the first cell in the second row
- 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:2 Changed 13 years ago by
| Description: | modified (diff) |
|---|
comment:3 Changed 13 years ago by
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |

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; } }