Parcourir la source

Add better comment about fixing selection dimensions.

Maciej Gołaszewski il y a 5 ans
Parent
commit
aa9a854d2c
1 fichiers modifiés avec 13 ajouts et 4 suppressions
  1. 13 4
      packages/ckeditor5-table/src/tableclipboard.js

+ 13 - 4
packages/ckeditor5-table/src/tableclipboard.js

@@ -167,10 +167,19 @@ export default class TableClipboard extends Plugin {
 				// Beyond this point we will operate on fixed content table.
 				splitCellsToRectangularSelection( selectedTable, splitDimensions, writer );
 			}
-			// However a rectangular selection might consist an invalid sub-table (if the selected cell would be moved outside the table).
-			// This happens in a table which has:
-			// - last row has empty slots (so are covered by cells from rows above) and/or
-			// - last column has empty slots (are covered by cells from previous columns)
+			// However a selected table fragment might be invalid if examined alone. Ie such table fragment:
+			//
+			//    +---+---+---+---+
+			//  0 | a | b | c | d |
+			//    +   +   +---+---+
+			//  1 |   | e | f | g |
+			//    +   +---+   +---+
+			//  2 |   | h |   | i | <- last row, each cell has rowspan = 2,
+			//    +   +   +   +   +    so we need to return 3, not 2
+			//  3 |   |   |   |   |
+			//    +---+---+---+---+
+			//
+			// is invalid as the cells "h" and "i" have rowspans.
 			// This case needs only adjusting the selection dimension as the rest of the algorithm operates on empty slots also.
 			else {
 				lastRowOfSelection = adjustLastRowIndex( selectedTable, rowIndexes, columnIndexes );