#2055: MergeDownCells error
----------------------+-----------------------------------------------------
Reporter: fireball | Type: Bug
Status: new | Priority: Normal
Milestone: | Component: General
Version: | Keywords:
----------------------+-----------------------------------------------------
'''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 ) ;
}
--
Ticket URL: <http://dev.fckeditor.net/ticket/2055>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac