Ticket #4784: 4784.patch
File 4784.patch, 1.7 KB (added by , 14 years ago) |
---|
-
_source/plugins/tabletools/plugin.js
86 86 return retval; 87 87 } 88 88 89 function getToFocusedCell( cellsToDelete ) { 90 var len = cellsToDelete.length, 91 firstCell = cellsToDelete[ 0 ], 92 lastCell = cellsToDelete[ len - 1 ], 93 td, tr; 94 95 // Where to put the cursor after cells been deleted? 96 // 1. Into next cell if any; 97 // 2. Into previous cell if any; 98 // 3. Into next row first cell if any; 99 // 4. Into previous row last cell if any; 100 101 return ( lastCell.getNext() 102 || firstCell.getPrevious() 103 || ( tr = lastCell.getParent().getNext() ) && tr.getChild( 0 ) 104 || ( tr = firstCell.getParent().getPrevious() ) && tr.getLast() 105 ); 106 107 } 108 89 109 function clearRow( $tr ) 90 110 { 91 111 // Get the array of row's cells. … … 277 297 if ( selectionOrCell instanceof CKEDITOR.dom.selection ) 278 298 { 279 299 var cellsToDelete = getSelectedCells( selectionOrCell ); 300 var cellToFocus = getToFocusedCell( cellsToDelete ); 301 280 302 for ( var i = cellsToDelete.length - 1 ; i >= 0 ; i-- ) 281 303 deleteCells( cellsToDelete[ i ] ); 304 305 if ( cellToFocus ) 306 { 307 placeCursorInCell( cellToFocus, true ); 308 } 309 282 310 } 283 311 else if ( selectionOrCell instanceof CKEDITOR.dom.element ) 284 312 { 285 if ( selectionOrCell.getParent().getChildCount() == 1 ) 286 selectionOrCell.getParent().remove(); 313 var tr = selectionOrCell.getParent(); 314 if ( tr.getChildCount() == 1 ) 315 tr.remove(); 287 316 else 288 317 selectionOrCell.remove(); 289 318 }