Ticket #1865: 1865_4a.patch
File 1865_4a.patch, 4.3 KB (added by , 14 years ago) |
---|
-
fcktablehandler.js
382 382 383 383 this._ReplaceCellsByMarker( tableMap, '_SelectedCells', refCell ) ; 384 384 this._UnmarkCells( cells, '_SelectedCells' ) ; 385 this._InstallTableMap( tableMap, refCell.parentNode.parentNode ) ;385 this._InstallTableMap( tableMap, refCell.parentNode.parentNode.parentNode ) ; 386 386 refCell.appendChild( cellContents ) ; 387 387 388 388 if ( FCKBrowserInfo.IsGeckoLike && ( ! refCell.firstChild ) ) … … 408 408 refCell.appendChild( cellContents ) ; 409 409 this._MarkCells( [nextCell], '_Replace' ) ; 410 410 this._ReplaceCellsByMarker( tableMap, '_Replace', refCell ) ; 411 this._InstallTableMap( tableMap, refCell.parentNode.parentNode ) ;411 this._InstallTableMap( tableMap, refCell.parentNode.parentNode.parentNode ) ; 412 412 413 413 this._MoveCaretToCell( refCell, false ) ; 414 414 } … … 430 430 refCell.appendChild( cellContents ) ; 431 431 this._MarkCells( [nextCell], '_Replace' ) ; 432 432 this._ReplaceCellsByMarker( tableMap, '_Replace', refCell ) ; 433 this._InstallTableMap( tableMap, refCell.parentNode.parentNode ) ;433 this._InstallTableMap( tableMap, refCell.parentNode.parentNode.parentNode ) ; 434 434 435 435 this._MoveCaretToCell( refCell, false ) ; 436 436 } … … 496 496 tableMap = newTableMap ; 497 497 } 498 498 499 this._InstallTableMap( tableMap, refCell.parentNode.parentNode ) ;499 this._InstallTableMap( tableMap, refCell.parentNode.parentNode.parentNode ) ; 500 500 } 501 501 502 502 FCKTableHandler.VerticalSplitCell = function() … … 540 540 newCell.colSpan = currentColSpan ; 541 541 if ( FCKBrowserInfo.IsGeckoLike ) 542 542 FCKTools.AppendBogusBr( newCell ) ; 543 currentCell.parentNode.parentNode. rows[newCellRowIndex].insertBefore( newCell, insertMarker ) ;543 currentCell.parentNode.parentNode.parentNode.rows[newCellRowIndex].insertBefore( newCell, insertMarker ) ; 544 544 } 545 545 else 546 546 { 547 547 // 1. Insert a new row. 548 var new CellRowIndex = currentRowIndex + 1 ;548 var newSectionRowIdx = currentCell.parentNode.sectionRowIndex + 1 ; 549 549 var newRow = FCK.EditorDocument.createElement( 'tr' ) ; 550 var t Body= currentCell.parentNode.parentNode ;551 if ( t Body.rows.length > newCellRowIndex )552 t Body.insertBefore( newRow, tBody.rows[newCellRowIndex] ) ;550 var tSection = currentCell.parentNode.parentNode ; 551 if ( tSection.rows.length > newSectionRowIdx ) 552 tSection.insertBefore( newRow, tSection.rows[newSectionRowIdx] ) ; 553 553 else 554 t Body.appendChild( newRow ) ;554 tSection.appendChild( newRow ) ; 555 555 556 556 // 2. +1 to rowSpan for all cells crossing currentCell's row. 557 557 for ( var i = 0 ; i < tableMap[currentRowIndex].length ; ) … … 615 615 // The difference here is that the "spanned" cells (colSpan and rowSpan) are duplicated on the matrix 616 616 // cells that are "spanned". For example, a row with 3 cells where the second cell has colSpan=2 and rowSpan=3 617 617 // will produce a bi-dimensional matrix with the following values (representing the cells): 618 // Cell1, Cell2, Cell2, Cell2, Cell 3 619 // Cell4, Cell2, Cell2, Cell2, Cell 5 618 // Cell1, Cell2, Cell2, Cell3 619 // Cell4, Cell2, Cell2, Cell5 620 // Cell6, Cell2, Cell2, Cell7 620 621 FCKTableHandler._CreateTableMap = function( refCell ) 621 622 { 622 // It's really a tbody, thead or tfoot. This is only temporary. 623 var table = (refCell.nodeName == 'TABLE' ? refCell : refCell.parentNode.parentNode ) ; 623 var table = (refCell.nodeName == 'TABLE' ? refCell : refCell.parentNode.parentNode.parentNode ) ; 624 624 625 625 var aRows = table.rows ; 626 626 … … 673 673 // for storing the calculated rowSpan in IE. 674 674 var rowSpanAttr = FCKBrowserInfo.IsIE ? "_fckrowspan" : "rowSpan" ; 675 675 676 // Clear the table of all rows first.677 while ( table.rows.length > 0 )678 {679 var row = table.rows[0] ;680 row.parentNode.removeChild( row ) ;681 }682 683 676 // Disconnect all the cells in tableMap from their parents, set all colSpan and rowSpan attributes to 1. 684 677 for ( var i = 0 ; i < tableMap.length ; i++ ) 685 678 { … … 764 757 if ( cell.rowSpan == 1 ) 765 758 cell.removeAttribute( 'rowspan' ) ; 766 759 } 767 table.appendChild( rowObj ) ; 760 if ( FCKBrowserInfo.IsIE ) 761 { 762 table.rows[i].replaceNode( rowObj ) ; 763 } 764 else 765 { 766 table.rows[i].innerHTML = '' ; 767 FCKDomTools.MoveChildren( rowObj, table.rows[i] ) ; 768 } 768 769 } 769 770 } 770 771