vendor/assets/ckeditor/ckeditor/_source/plugins/tabletools/plugin.js in rich-1.0.3 vs vendor/assets/ckeditor/ckeditor/_source/plugins/tabletools/plugin.js in rich-1.1.0

- old
+ new

@@ -1,20 +1,16 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { var cellNodeRegex = /^(?:td|th)$/; function getSelectedCells( selection ) { - // Walker will try to split text nodes, which will make the current selection - // invalid. So save bookmarks before doing anything. - var bookmarks = selection.createBookmarks(); - var ranges = selection.getRanges(); var retval = []; var database = {}; function moveOutOfCellGuard( node ) @@ -70,13 +66,10 @@ } } CKEDITOR.dom.element.clearAllMarkers( database ); - // Restore selection position. - selection.selectBookmarks( bookmarks ); - return retval; } function getFocusElementAfterDelCells( cellsToDelete ) { var i = 0, @@ -488,24 +481,22 @@ return new CKEDITOR.dom.element( oRow[ c ] ); } return cell.is ? -1 : null; } - function cellInCol( tableMap, colIndex, cell ) + function cellInCol( tableMap, colIndex ) { var oCol = []; for ( var r = 0; r < tableMap.length; r++ ) { var row = tableMap[ r ]; - if ( typeof cell == 'undefined' ) - oCol.push( row[ colIndex ] ); - else if ( cell.is && row[ colIndex ] == cell.$ ) - return r; - else if ( r == cell ) - return new CKEDITOR.dom.element( row[ colIndex ] ); - } + oCol.push( row[ colIndex ] ); - return ( typeof cell == 'undefined' )? oCol : cell.is ? -1 : null; + // Avoid adding duplicate cells. + if ( row[ colIndex ].rowSpan > 1 ) + r += row[ colIndex ].rowSpan - 1; + } + return oCol; } function mergeCells( selection, mergeDirection, isDetect ) { var cells = getSelectedCells( selection );