Ticket #2859: 2859.patch
File 2859.patch, 3.3 KB (added by , 15 years ago) |
---|
-
fcktablehandler.js
360 360 var rowIdx = refCell.parentNode.rowIndex ; 361 361 var colIdx = this._GetCellIndexSpan( tableMap, rowIdx, refCell ) ; 362 362 363 this._MarkCells( cells, '_ SelectedCells' ) ;364 var selectionGeometry = this._GetMarkerGeometry( tableMap, rowIdx, colIdx, '_ SelectedCells' ) ;363 this._MarkCells( cells, '_Replace' ) ; 364 var selectionGeometry = this._GetMarkerGeometry( tableMap, rowIdx, colIdx, '_Replace' ) ; 365 365 366 366 var baseColIdx = colIdx - selectionGeometry.x ; 367 367 var baseRowIdx = rowIdx - selectionGeometry.y ; … … 387 387 cellContents.appendChild( FCK.EditorDocument.createElement( 'br' ) ) ; 388 388 } 389 389 390 this._ReplaceCellsByMarker( tableMap, '_ SelectedCells', refCell ) ;391 this._UnmarkCells( cells, '_SelectedCells' ) ;390 this._ReplaceCellsByMarker( tableMap, '_Replace', refCell ) ; 391 this._UnmarkCells( [refCell], '_Replace' ) ; 392 392 this._InstallTableMap( tableMap, refCell.parentNode.parentNode.parentNode ) ; 393 393 refCell.appendChild( cellContents ) ; 394 394 … … 680 680 // for storing the calculated rowSpan in IE. 681 681 var rowSpanAttr = FCKBrowserInfo.IsIE ? "_fckrowspan" : "rowSpan" ; 682 682 683 // Check for identical columns in tableMap, 684 // to remove them to get a proper colspan. 685 var doubleCol = new Array() ; 686 for ( var i = 0 ; i < tableMap.length ; i++ ) 687 { 688 for ( var j = 0; j < tableMap[i].length ; j++ ) 689 { 690 // When doubleCol[j] == 0 the previous column is definitly not identical to the current one 691 if( doubleCol[j] == 0 ) 692 continue ; 693 else if ( tableMap[i][j-1] && tableMap[i][j-1] == tableMap[i][j] ) 694 doubleCol[j] = 1 ; 695 else 696 doubleCol[j] = 0 ; 697 } 698 } 699 700 // Build a temporary newTableMap. 701 var newTableMap = new Array() ; 702 for ( var i = 0 ; i < tableMap.length ; i++ ) 703 { 704 var doubleRow = 1 ; 705 var newRow = new Array() ; 706 for ( var j = 0; j < tableMap[i].length ; j++ ) 707 { 708 if( i == 0 || ( i > 0 && tableMap[i][j] != tableMap[i-1][j] ) ) 709 doubleRow = 0 ; 710 711 // Only insert the cell into newTableMap if the previous column is not identical to the current one. 712 if( doubleCol[j] == 0 ) 713 newRow.push( tableMap[i][j] ) ; 714 } 715 // Only insert the row into newTableMap if the previous row is not identical to the current one. 716 if( doubleRow == 0 ) 717 newTableMap.push( newRow ) ; 718 } 719 720 // Replace tableMap with the temporary newTableMap. 721 tableMap = newTableMap ; 722 683 723 // Disconnect all the cells in tableMap from their parents, set all colSpan and rowSpan attributes to 1. 684 724 for ( var i = 0 ; i < tableMap.length ; i++ ) 685 725 { … … 774 814 FCKDomTools.MoveChildren( rowObj, table.rows[i] ) ; 775 815 } 776 816 } 817 818 // Remove cells marked with '_Replace' and remove empty rows. 819 var aRows = table.getElementsByTagName( 'TR' ) ; 820 for ( var i = aRows.length - 1; i >= 0; i-- ) 821 { 822 for ( var t = 0; t < aRows[i].cells.length; t++ ) 823 { 824 if( aRows[i].cells[t]['_Replace'] ) 825 aRows[i].deleteCell(t) ; 826 } 827 828 if ( aRows[i].cells.length == 0 ) 829 aRows[i].parentNode.removeChild( aRows[i] ) ; 830 } 777 831 } 778 832 779 833 FCKTableHandler._MoveCaretToCell = function ( refCell, toStart )