Ticket #2778: 2778.patch

File 2778.patch, 1.5 KB (added by Koen Willems, 15 years ago)
  • fcktablehandler.js

     
    673673        // for storing the calculated rowSpan in IE.
    674674        var rowSpanAttr = FCKBrowserInfo.IsIE ? "_fckrowspan" : "rowSpan" ;
    675675
     676        // Check for identical columns in tableMap,
     677        // to remove them to get a proper colspan.
     678        var doubleCol = new Array() ;
     679        for ( var i = 0 ; i < tableMap.length ; i++ )
     680        {
     681                for ( var j = 0; j < tableMap[i].length ; j++ )
     682                {
     683                        // When doubleCol[j] == 0 the previous column is definitly not identical to the current one
     684                        if( doubleCol[j] == 0 )
     685                                continue ;
     686                        else if ( tableMap[i][j-1] && tableMap[i][j-1] == tableMap[i][j] )
     687                                doubleCol[j] = 1 ;
     688                        else
     689                                doubleCol[j] = 0 ;
     690                }
     691        }
     692
     693        // Build a temporary newTableMap.
     694        var newTableMap = new Array() ;
     695        for ( var i = 0 ; i < tableMap.length ; i++ )
     696        {
     697                var newRow = new Array() ;
     698                for ( var j = 0; j < tableMap[i].length ; j++ )
     699                {
     700                        // Only insert the cell into newTableMap if the previous column is not identical to the current one.
     701                        if( doubleCol[j] == 0 )
     702                                newRow.push( tableMap[i][j] ) ;
     703                }
     704                newTableMap.push( newRow ) ;
     705        }
     706
     707        // Replace tableMap with the temporary newTableMap.
     708        tableMap = newTableMap ;
     709
    676710        // Disconnect all the cells in tableMap from their parents, set all colSpan and rowSpan attributes to 1.
    677711        for ( var i = 0 ; i < tableMap.length ; i++ )
    678712        {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy