Selaa lähdekoodia

Merge branch 'master' into i/6502

Aleksander Nowodzinski 5 vuotta sitten
vanhempi
commit
813cd54b53

+ 0 - 3
packages/ckeditor5-table/src/commands/mergecellscommand.js

@@ -47,9 +47,6 @@ export default class MergeCellsCommand extends Command {
 			// All cells will be merge into the first one.
 			const firstTableCell = selectedTableCells.shift();
 
-			// This prevents the "model-selection-range-intersects" error, caused by removing row selected cells.
-			writer.setSelection( firstTableCell, 'on' );
-
 			// Update target cell dimensions.
 			const { mergeWidth, mergeHeight } = getMergeDimensions( firstTableCell, selectedTableCells, tableUtils );
 			updateNumericAttribute( 'colspan', mergeWidth, firstTableCell, writer );

+ 0 - 3
packages/ckeditor5-table/src/commands/removecolumncommand.js

@@ -65,9 +65,6 @@ export default class RemoveColumnCommand extends Command {
 		const cellToFocus = getCellToFocus( tableMap, firstCell, lastCell, removedColumnIndexes );
 
 		this.editor.model.change( writer => {
-			// A temporary workaround to avoid the "model-selection-range-intersects" error.
-			writer.setSelection( writer.createRangeOn( table ) );
-
 			const columnsToRemove = removedColumnIndexes.last - removedColumnIndexes.first + 1;
 
 			this.editor.plugins.get( 'TableUtils' ).removeColumns( table, {

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

@@ -167,9 +167,8 @@ function compareRangeOrder( rangeA, rangeB ) {
 	const posA = rangeA.start;
 	const posB = rangeB.start;
 
-	if ( posA.isEqual( posB ) ) {
-		return 0;
-	}
-
+	// Checking for equal position (returning 0) is not needed because this would be either:
+	// a. Intersecting range (not allowed by model)
+	// b. Collapsed range on the same position (allowed by model but should not happen).
 	return posA.isBefore( posB ) ? -1 : 1;
 }