Changeset 2373 for FCKeditor/trunk
- Timestamp:
- 2008-08-25 21:57:41 (5 months ago)
- Location:
- FCKeditor/trunk
- Files:
-
- 2 modified
-
editor/_source/internals/fcktablehandler.js (modified) (12 diffs)
-
_whatsnew.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/_source/internals/fcktablehandler.js
r2283 r2373 299 299 this._MarkCells( cells, '_CellSelected' ) ; 300 300 301 var tableMap = this._CreateTableMap( cells[0] .parentNode.parentNode) ;301 var tableMap = this._CreateTableMap( cells[0] ) ; 302 302 var rowIdx = cells[0].parentNode.rowIndex ; 303 303 var colIdx = this._GetCellIndexSpan( tableMap, rowIdx, cells[0] ) ; … … 358 358 // Because the checking is already done by FCKTableCommand. 359 359 var refCell = cells[0] ; 360 var tableMap = this._CreateTableMap( refCell .parentNode.parentNode) ;360 var tableMap = this._CreateTableMap( refCell ) ; 361 361 var rowIdx = refCell.parentNode.rowIndex ; 362 362 var colIdx = this._GetCellIndexSpan( tableMap, rowIdx, refCell ) ; … … 451 451 452 452 var refCell = cells[0] ; 453 var tableMap = this._CreateTableMap( refCell .parentNode.parentNode) ;453 var tableMap = this._CreateTableMap( refCell ) ; 454 454 var rowIdx = refCell.parentNode.rowIndex ; 455 455 var colIdx = FCKTableHandler._GetCellIndexSpan( tableMap, rowIdx, refCell ) ; … … 458 458 if ( cellSpan > 1 ) 459 459 { 460 // Splitt ng a multi-column cell - original cell gets ceil(colSpan/2) columns,460 // Splitting a multi-column cell - original cell gets ceil(colSpan/2) columns, 461 461 // new cell gets floor(colSpan/2). 462 462 var newCellSpan = Math.ceil( cellSpan / 2 ) ; 463 var newCell = FCK Tools.GetElementDocument( refCell ).createElement( 'td') ;463 var newCell = FCK.EditorDocument.createElement( refCell.nodeName ) ; 464 464 if ( FCKBrowserInfo.IsGeckoLike ) 465 465 FCKTools.AppendBogusBr( newCell ) ; … … 489 489 { 490 490 newRow.push( refCell ) ; 491 newRow.push( FCK Tools.GetElementDocument( refCell ).createElement( 'td') ) ;491 newRow.push( FCK.EditorDocument.createElement( refCell.nodeName ) ) ; 492 492 if ( FCKBrowserInfo.IsGeckoLike ) 493 493 FCKTools.AppendBogusBr( newRow[newRow.length - 1] ) ; … … 515 515 516 516 var currentCell = cells[0] ; 517 var tableMap = this._CreateTableMap( currentCell.parentNode.parentNode ) ; 518 var cellIndex = FCKTableHandler._GetCellIndexSpan( tableMap, currentCell.parentNode.rowIndex, currentCell ) ; 517 var tableMap = this._CreateTableMap( currentCell ) ; 518 var currentRowIndex = currentCell.parentNode.rowIndex ; 519 var cellIndex = FCKTableHandler._GetCellIndexSpan( tableMap, currentRowIndex, currentCell ) ; 519 520 var currentRowSpan = currentCell.rowSpan ; 520 var currentRowIndex = currentCell.parentNode.rowIndex ;521 521 if ( isNaN( currentRowSpan ) ) 522 522 currentRowSpan = 1 ; … … 529 529 // 2. Find the appropriate place to insert a new cell at the next row. 530 530 var newCellRowIndex = currentRowIndex + Math.ceil( currentRowSpan / 2 ) ; 531 var oRow = tableMap[newCellRowIndex] ; 531 532 var insertMarker = null ; 532 for ( var i = cellIndex+1 ; i < tableMap[newCellRowIndex].length ; i++ )533 { 534 if ( tableMap[newCellRowIndex][i].parentNode.rowIndex == newCellRowIndex )535 { 536 insertMarker = tableMap[newCellRowIndex][i] ;533 for ( var i = cellIndex+1 ; i < oRow.length ; i++ ) 534 { 535 if ( oRow[i].parentNode.rowIndex == newCellRowIndex ) 536 { 537 insertMarker = oRow[i] ; 537 538 break ; 538 539 } … … 540 541 541 542 // 3. Insert the new cell to the indicated place, with the appropriate rowSpan, next row. 542 var newCell = FCK.EditorDocument.createElement( 'td') ;543 var newCell = FCK.EditorDocument.createElement( currentCell.nodeName ) ; 543 544 newCell.rowSpan = Math.floor( currentRowSpan / 2 ) ; 544 545 if ( FCKBrowserInfo.IsGeckoLike ) … … 576 577 577 578 // 3. Insert a new cell to new row. 578 var newCell = FCK.EditorDocument.createElement( 'td') ;579 var newCell = FCK.EditorDocument.createElement( currentCell.nodeName ) ; 579 580 if ( FCKBrowserInfo.IsGeckoLike ) 580 581 FCKTools.AppendBogusBr( newCell ) ; … … 632 633 // cells that are "spanned". For example, a row with 3 cells where the second cell has colSpan=2 and rowSpan=3 633 634 // will produce a bi-dimensional matrix with the following values (representing the cells): 634 // Cell1, Cell2, Cell2, Cell 3 635 // Cell4, Cell2, Cell2, Cell 5 636 FCKTableHandler._CreateTableMap = function( table ) 637 { 635 // Cell1, Cell2, Cell2, Cell2, Cell 3 636 // Cell4, Cell2, Cell2, Cell2, Cell 5 637 FCKTableHandler._CreateTableMap = function( refCell ) 638 { 639 // It's really a tbody, thead or tfoot. This is only temporary. 640 var table = (refCell.nodeName == 'TABLE' ? refCell : refCell.parentNode.parentNode ) ; 641 638 642 var aRows = table.rows ; 639 643 … … 820 824 821 825 var refCell = cells[0] ; 822 var tableMap = this._CreateTableMap( refCell .parentNode.parentNode) ;826 var tableMap = this._CreateTableMap( refCell ) ; 823 827 var rowIdx = refCell.parentNode.rowIndex ; 824 828 var colIdx = this._GetCellIndexSpan( tableMap, rowIdx, refCell ) ; … … 848 852 849 853 var refCell = cells[0] ; 850 var tableMap = this._CreateTableMap( refCell .parentNode.parentNode) ;854 var tableMap = this._CreateTableMap( refCell ) ; 851 855 var rowIdx = refCell.parentNode.rowIndex ; 852 856 var colIdx = this._GetCellIndexSpan( tableMap, rowIdx, refCell ) ; -
FCKeditor/trunk/_whatsnew.html
r2363 r2373 51 51 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2467">#2467</a>] Fixed JavaScript 52 52 error with the fit window command in source mode.</li> 53 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2472">#2472</a>] Splitting a TH 54 will create a two TH, not a TH and a TD.</li> 53 55 </ul> 54 56 <p>