8
0
Quellcode durchsuchen

Minor refactor.

Maciej Gołaszewski vor 5 Jahren
Ursprung
Commit
7385fcb656

+ 2 - 2
packages/ckeditor5-table/src/tableclipboard.js

@@ -529,7 +529,7 @@ function adjustLastRowIndex( table, rowIndexes, columnIndexes ) {
 	}
 
 	// Otherwise get any cell's rowspan and adjust the last row index.
-	const rowspanAdjustment = lastRowMap.pop().rowspan - 1;
+	const rowspanAdjustment = lastRowMap[ 0 ].rowspan - 1;
 	return rowIndexes.last + rowspanAdjustment;
 }
 
@@ -565,6 +565,6 @@ function adjustLastColumnIndex( table, rowIndexes, columnIndexes ) {
 	}
 
 	// Otherwise get any cell's colspan and adjust the last column index.
-	const colspanAdjustment = lastColumnMap.pop().colspan - 1;
+	const colspanAdjustment = lastColumnMap[ 0 ].colspan - 1;
 	return columnIndexes.last + colspanAdjustment;
 }

+ 4 - 4
packages/ckeditor5-table/src/utils.js

@@ -278,9 +278,9 @@ export function getVerticallyOverlappingCells( table, overlapRow, startRow = 0 )
 
 	for ( const slotInfo of tableWalker ) {
 		const { row, rowspan } = slotInfo;
-		const slotEndRow = row + rowspan - 1;
+		const cellEndRow = row + rowspan - 1;
 
-		if ( row < overlapRow && overlapRow <= slotEndRow ) {
+		if ( row < overlapRow && overlapRow <= cellEndRow ) {
 			cells.push( slotInfo );
 		}
 	}
@@ -372,9 +372,9 @@ export function getHorizontallyOverlappingCells( table, overlapColumn ) {
 
 	for ( const slotInfo of tableWalker ) {
 		const { column, colspan } = slotInfo;
-		const slotEndColumn = column + colspan - 1;
+		const cellEndColumn = column + colspan - 1;
 
-		if ( column < overlapColumn && overlapColumn <= slotEndColumn ) {
+		if ( column < overlapColumn && overlapColumn <= cellEndColumn ) {
 			cellsToSplit.push( slotInfo );
 		}
 	}