Ticket #1865: 1865_2.patch
File 1865_2.patch, 4.4 KB (added by , 16 years ago) |
---|
-
editor/_source/internals/fcktablehandler.js
52 52 //queue up the rows -- it's possible ( and likely ) that we may get duplicates 53 53 for ( var i = 0; i < aCells.length; i++ ) 54 54 { 55 var oRow = FCKTools.GetElementAscensor( aCells[i],'TR' );55 var oRow = aCells[i].parentNode ; 56 56 aRowsToDelete[oRow.rowIndex] = oRow ; 57 57 } 58 58 for ( var i = aRowsToDelete.length; i >= 0; i-- ) … … 118 118 119 119 var iIndex = oCell.cellIndex ; 120 120 121 // Loop thro wall rows available in the table.121 // Loop through all rows available in the table. 122 122 for ( var i = 0 ; i < oTable.rows.length ; i++ ) 123 123 { 124 124 // Get the row. 125 125 var oRow = oTable.rows[i] ; 126 126 127 // If the row doe ns't have enough cells, ignore it.127 // If the row doesn't have enough cells, ignore it. 128 128 if ( oRow.cells.length < ( iIndex + 1 ) ) 129 129 continue ; 130 130 … … 136 136 // Get back the currently selected cell. 137 137 var oBaseCell = oRow.cells[iIndex] ; 138 138 139 if ( insertBefore ) 140 oRow.insertBefore( oCell, oBaseCell ) ; 141 else if ( oBaseCell.nextSibling ) 142 oRow.insertBefore( oCell, oBaseCell.nextSibling ) ; 143 else 144 oRow.appendChild( oCell ) ; 139 oRow.insertBefore( oCell, ( insertBefore ? oBaseCell : oBaseCell.nextSibling ) ) ; 145 140 } 146 141 } 147 142 … … 218 213 if ( cell.parentNode.cells.length == 1 ) 219 214 { 220 215 // Delete the entire row. 221 FCKTableHandler.DeleteRows( FCKTools.GetElementAscensor( cell, 'TR' )) ;216 FCKTableHandler.DeleteRows( cell.parentNode ) ; 222 217 return ; 223 218 } 224 219 … … 246 241 { 247 242 for ( var i = 0 ; i < cells.length ; i++ ) 248 243 { 249 if ( FCKBrowserInfo.IsIE ) 250 cells[i].removeAttribute( label ) ; 251 else 252 delete cells[i][label] ; 244 FCKDomTools.ClearElementJSProperty(cells[i], label ) ; 253 245 } 254 246 } 255 247 … … 385 377 } 386 378 } 387 379 if ( rowChildNodesCount > 0 ) 388 cellContents.appendChild( FCK Tools.GetElementDocument( refCell ).createElement( 'br' ) ) ;380 cellContents.appendChild( FCK.EditorDocument.createElement( 'br' ) ) ; 389 381 } 390 382 391 383 this._ReplaceCellsByMarker( tableMap, '_SelectedCells', refCell ) ; … … 434 426 while ( nextCell && nextCell.childNodes && nextCell.childNodes.length > 0 ) 435 427 cellContents.appendChild( nextCell.removeChild( nextCell.firstChild ) ) ; 436 428 if ( cellContents.firstChild ) 437 cellContents.insertBefore( FCK Tools.GetElementDocument( nextCell ).createElement( 'br' ), cellContents.firstChild ) ;429 cellContents.insertBefore( FCK.EditorDocument.createElement( 'br' ), cellContents.firstChild ) ; 438 430 refCell.appendChild( cellContents ) ; 439 431 this._MarkCells( [nextCell], '_Replace' ) ; 440 432 this._ReplaceCellsByMarker( tableMap, '_Replace', refCell ) ; … … 619 611 return null ; 620 612 } 621 613 622 // Get the cells available in a column of a TableMap.623 FCKTableHandler._GetColumnCells = function( tableMap, columnIndex )624 {625 var aCollCells = new Array() ;626 627 for ( var r = 0 ; r < tableMap.length ; r++ )628 {629 var oCell = tableMap[r][columnIndex] ;630 if ( oCell && ( aCollCells.length == 0 || aCollCells[ aCollCells.length - 1 ] != oCell ) )631 aCollCells[ aCollCells.length ] = oCell ;632 }633 634 return aCollCells ;635 }636 637 614 // This function is quite hard to explain. It creates a matrix representing all cells in a table. 638 615 // The difference here is that the "spanned" cells (colSpan and rowSpan) are duplicated on the matrix 639 616 // cells that are "spanned". For example, a row with 3 cells where the second cell has colSpan=2 and rowSpan=3 … … 758 735 for ( var j = 0 ; j < tableMap[i].length ; j++) 759 736 { 760 737 var cell = tableMap[i][j] ; 761 if ( FCKBrowserInfo.IsIE ) 762 { 763 cell.removeAttribute( '_colScanned' ) ; 764 cell.removeAttribute( '_rowScanned' ) ; 765 } 766 else 767 { 768 delete cell._colScanned ; 769 delete cell._rowScanned ; 770 } 738 FCKDomTools.ClearElementJSProperty(cell, '_colScanned' ) ; 739 FCKDomTools.ClearElementJSProperty(cell, '_rowScanned' ) ; 771 740 } 772 741 } 773 742 774 743 // Insert physical rows and columns to the table. 775 744 for ( var i = 0 ; i < tableMap.length ; i++ ) 776 745 { 777 var rowObj = FCK Tools.GetElementDocument( table ).createElement( 'tr' ) ;746 var rowObj = FCK.EditorDocument.createElement( 'tr' ) ; 778 747 for ( var j = 0 ; j < tableMap[i].length ; ) 779 748 { 780 749 var cell = tableMap[i][j] ;