Ticket #2055 (closed Bug: duplicate)
MergeDownCells error
| Reported by: | fireball | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | General | Version: | FCKeditor 2.5 |
| Keywords: | Confirmed | Cc: |
Description
FCKEditor2.5 IE6.0 MergeDownCells twice Error! if ( tableMap[j-1] && tableMap[j-1][i] == cell )
{
alert("old:"+cell.rowSpan);
cell.rowSpan++ ;
alert("new:"+cell.rowSpan)
} result is old:1 new:1
so I changed it:
// Disconnect all the cells in tableMap from their parents, set all colSpan and rowSpan attributes to 1. for ( var i = 0 ; i < tableMap.length ; i++ ) {
for ( var j = 0 ; j < tableMap[i].length ; j++ ) {
var cell = tableMap[i][j] ; if ( cell.parentNode )
cell.parentNode.removeChild( cell ) ;
cell.colSpan = cell.rowSpan = 1 ;
//add to count cell.rowSpan:wangxiuling
cell.rowsCount=1;
}
}
// Scan by columns and set rowSpan.
for ( var i = 0 ; i <= maxCol ; i++ ) {
for ( var j = 0 ; j < tableMap.length ; j++ ) {
if ( ! tableMap[j] )
continue ;
var cell = tableMap[j][i] ;
if ( ! cell
cell._rowScanned === true ) continue ;
if ( tableMap[j-1] && tableMap[j-1][i] == cell )
{
cell.rowSpan++ ;
//add by wangxiuling
cell.rowsCount++;
} if ( ! tableMap[j+1]
tableMap[j+1][i] != cell ) cell._rowScanned = true ;
}
}
// Insert physical rows and columns to the table.
for ( var i = 0 ; i < tableMap.length ; i++ ) {
var rowObj = table.ownerDocument.createElement( 'tr' ) ; for ( var j = 0 ; j < tableMap[i].length ; ) {
var cell = tableMap[i][j] ; if ( tableMap[i-1] && tableMap[i-1][j] == cell ) {
j += cell.colSpan ; continue ;
}
//add by wangxiuling
cell.rowSpan=cell.rowsCount
rowObj.appendChild( cell ) ; j += cell.colSpan ; if ( cell.colSpan == 1 )
cell.removeAttribute( 'colspan' ) ;
if ( cell.rowSpan == 1 )
cell.removeAttribute( 'rowspan' ) ;
} table.appendChild( rowObj ) ;
}
Change History
Note: See TracTickets for help on using tickets.Download in other formats: