Przeglądaj źródła

Remove MergeCellsCommand from base table selection solution.

Maciej Gołaszewski 6 lat temu
rodzic
commit
55ad0186a4

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

@@ -1,260 +0,0 @@
-/**
- * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-/**
- * @module table/commands/mergecellscommand
- */
-
-import Command from '@ckeditor/ckeditor5-core/src/command';
-import TableWalker from '../tablewalker';
-import { findAncestor, updateNumericAttribute } from './utils';
-import TableUtils from '../tableutils';
-
-/**
- * The merge cells command.
- *
- * The command is registered by {@link module:table/tableediting~TableEditing} as `'mergeTableCellRight'`, `'mergeTableCellLeft'`,
- * `'mergeTableCellUp'` and `'mergeTableCellDown'` editor commands.
- *
- * To merge a table cell at the current selection with another cell, execute the command corresponding with the preferred direction.
- *
- * For example, to merge with a cell to the right:
- *
- *        editor.execute( 'mergeTableCellRight' );
- *
- * **Note**: If a table cell has a different [`rowspan`](https://www.w3.org/TR/html50/tabular-data.html#attr-tdth-rowspan)
- * (for `'mergeTableCellRight'` and `'mergeTableCellLeft'`) or [`colspan`](https://www.w3.org/TR/html50/tabular-data.html#attr-tdth-colspan)
- * (for `'mergeTableCellUp'` and `'mergeTableCellDown'`), the command will be disabled.
- *
- * @extends module:core/command~Command
- */
-export default class MergeCellsCommand extends Command {
-	/**
-	 * @inheritDoc
-	 */
-	refresh() {
-		this.isEnabled = canMergeCells( this.editor.model.document.selection, this.editor.plugins.get( TableUtils ) );
-	}
-
-	/**
-	 * Executes the command.
-	 *
-	 * Depending on the command's {@link #direction} value, it will merge the cell that is to the `'left'`, `'right'`, `'up'` or `'down'`.
-	 *
-	 * @fires execute
-	 */
-	execute() {
-		const model = this.editor.model;
-
-		const tableUtils = this.editor.plugins.get( TableUtils );
-
-		model.change( writer => {
-			const selectedTableCells = [ ... this.editor.model.document.selection.getRanges() ].map( range => range.start.nodeAfter );
-
-			const firstTableCell = selectedTableCells.shift();
-
-			// TODO: this shouldn't be necessary (right now the selection could overlap existing.
-			writer.setSelection( firstTableCell, 'in' );
-
-			const { row, column } = tableUtils.getCellLocation( firstTableCell );
-
-			const colspan = parseInt( firstTableCell.getAttribute( 'colspan' ) || 1 );
-			const rowspan = parseInt( firstTableCell.getAttribute( 'rowspan' ) || 1 );
-
-			let rightMax = column + colspan;
-			let bottomMax = row + rowspan;
-
-			const rowsToCheck = new Set();
-
-			for ( const tableCell of selectedTableCells ) {
-				const { row, column } = tableUtils.getCellLocation( tableCell );
-
-				const colspan = parseInt( tableCell.getAttribute( 'colspan' ) || 1 );
-				const rowspan = parseInt( tableCell.getAttribute( 'rowspan' ) || 1 );
-
-				if ( column + colspan > rightMax ) {
-					rightMax = column + colspan;
-				}
-
-				if ( row + rowspan > bottomMax ) {
-					bottomMax = row + rowspan;
-				}
-			}
-
-			for ( const tableCell of selectedTableCells ) {
-				rowsToCheck.add( tableCell.parent );
-				mergeTableCells( tableCell, firstTableCell, writer );
-			}
-
-			// Update table cell span attribute and merge set selection on merged contents.
-			updateNumericAttribute( 'colspan', rightMax - column, firstTableCell, writer );
-			updateNumericAttribute( 'rowspan', bottomMax - row, firstTableCell, writer );
-
-			writer.setSelection( firstTableCell, 'in' );
-
-			// Remove empty rows after merging table cells.
-			for ( const row of rowsToCheck ) {
-				if ( !row.childCount ) {
-					removeEmptyRow( row, writer );
-				}
-			}
-		} );
-	}
-}
-
-// Properly removes empty row from a table. Will update `rowspan` attribute of cells that overlaps removed row.
-//
-// @param {module:engine/model/element~Element} removedTableCellRow
-// @param {module:engine/model/writer~Writer} writer
-function removeEmptyRow( removedTableCellRow, writer ) {
-	const table = removedTableCellRow.parent;
-
-	const removedRowIndex = table.getChildIndex( removedTableCellRow );
-
-	for ( const { cell, row, rowspan } of new TableWalker( table, { endRow: removedRowIndex } ) ) {
-		const overlapsRemovedRow = row + rowspan - 1 >= removedRowIndex;
-
-		if ( overlapsRemovedRow ) {
-			updateNumericAttribute( 'rowspan', rowspan - 1, cell, writer );
-		}
-	}
-
-	writer.remove( removedTableCellRow );
-}
-
-// Merges two table cells - will ensure that after merging cells with empty paragraph the result table cell will only have one paragraph.
-// If one of the merged table cell is empty the merged table cell will have contents of the non-empty table cell.
-// If both are empty the merged table cell will have only one empty paragraph.
-//
-// @param {module:engine/model/element~Element} cellToRemove
-// @param {module:engine/model/element~Element} cellToExpand
-// @param {module:engine/model/writer~Writer} writer
-function mergeTableCells( cellToRemove, cellToExpand, writer ) {
-	if ( !isEmpty( cellToRemove ) ) {
-		if ( isEmpty( cellToExpand ) ) {
-			writer.remove( writer.createRangeIn( cellToExpand ) );
-		}
-
-		writer.move( writer.createRangeIn( cellToRemove ), writer.createPositionAt( cellToExpand, 'end' ) );
-	}
-
-	// Remove merged table cell.
-	writer.remove( cellToRemove );
-}
-
-// Checks if passed table cell contains empty paragraph.
-//
-// @param {module:engine/model/element~Element} tableCell
-// @returns {Boolean}
-function isEmpty( tableCell ) {
-	return tableCell.childCount == 1 && tableCell.getChild( 0 ).is( 'paragraph' ) && tableCell.getChild( 0 ).isEmpty;
-}
-
-// Check if selection contains mergeable cells.
-//
-// In a table below:
-//
-//   +---+---+---+---+
-//   | a | b | c | d |
-//   +---+---+---+   +
-//   | e     | f |   |
-//   +       +---+---+
-//   |       | g | h |
-//   +---+---+---+---+
-//
-// Valid selections are those which creates a solid rectangle (without gaps), such as:
-//   - a, b (two horizontal cells)
-//   - c, f (two vertical cells)
-//   - a, b, e (cell "e" spans over four cells)
-//   - c, d, f (cell d spans over cell in row below)
-//
-// While invalid selection would be:
-//   - a, c (cell "b" not selected creates a gap)
-//   - f, g, h (cell "d" spans over a cell from row of "f" cell - thus creates a gap)
-//
-// @param {module:engine/model/selection~Selection} selection
-// @param {module:table/tableUtils~TableUtils} tableUtils
-// @returns {boolean}
-function canMergeCells( selection, tableUtils ) {
-	// Collapsed selection or selection only one range can't contain mergeable table cells.
-	if ( selection.isCollapsed || selection.rangeCount < 2 ) {
-		return false;
-	}
-
-	// All cells must be inside the same table.
-	let firstRangeTable;
-
-	const tableCells = [];
-
-	for ( const range of selection.getRanges() ) {
-		// Selection ranges must be set on whole <tableCell> element.
-		if ( range.isCollapsed || !range.isFlat || !range.start.nodeAfter.is( 'tableCell' ) ) {
-			return false;
-		}
-
-		const parentTable = findAncestor( 'table', range.start );
-
-		if ( !firstRangeTable ) {
-			firstRangeTable = parentTable;
-		} else if ( firstRangeTable !== parentTable ) {
-			return false;
-		}
-
-		tableCells.push( range.start.nodeAfter );
-	}
-
-	// At this point selection contains ranges over table cells in the same table.
-	// The valid selection is a fully occupied rectangle composed of table cells.
-	// Below we calculate area of selected cells and the area of valid selection.
-	// The area of valid selection is defined by top-left and bottom-right cells.
-	const rows = new Set();
-	const columns = new Set();
-
-	let areaOfSelectedCells = 0;
-
-	for ( const tableCell of tableCells ) {
-		const { row, column } = tableUtils.getCellLocation( tableCell );
-		const rowspan = parseInt( tableCell.getAttribute( 'rowspan' ) || 1 );
-		const colspan = parseInt( tableCell.getAttribute( 'colspan' ) || 1 );
-
-		// Record row & column indexes of current cell.
-		rows.add( row );
-		columns.add( column );
-
-		// For cells that spans over multiple rows add also the last row that this cell spans over.
-		if ( rowspan > 1 ) {
-			rows.add( row + rowspan - 1 );
-		}
-
-		// For cells that spans over multiple columns add also the last column that this cell spans over.
-		if ( colspan > 1 ) {
-			columns.add( column + colspan - 1 );
-		}
-
-		areaOfSelectedCells += ( rowspan * colspan );
-	}
-
-	// We can only merge table cells that are in adjacent rows...
-	const areaOfValidSelection = getBiggestRectangleArea( rows, columns );
-
-	return areaOfValidSelection == areaOfSelectedCells;
-}
-
-// Calculates the area of a maximum rectangle that can span over provided row & column indexes.
-//
-// @param {Array.<Number>} rows
-// @param {Array.<Number>} columns
-// @returns {Number}
-function getBiggestRectangleArea( rows, columns ) {
-	const rowsIndexes = Array.from( rows.values() );
-	const columnIndexes = Array.from( columns.values() );
-
-	const lastRow = Math.max( ...rowsIndexes );
-	const firstRow = Math.min( ...rowsIndexes );
-	const lastColumn = Math.max( ...columnIndexes );
-	const firstColumn = Math.min( ...columnIndexes );
-
-	return ( lastRow - firstRow + 1 ) * ( lastColumn - firstColumn + 1 );
-}

+ 0 - 3
packages/ckeditor5-table/src/tableediting.js

@@ -28,7 +28,6 @@ import RemoveRowCommand from './commands/removerowcommand';
 import RemoveColumnCommand from './commands/removecolumncommand';
 import SetHeaderRowCommand from './commands/setheaderrowcommand';
 import SetHeaderColumnCommand from './commands/setheadercolumncommand';
-import MergeCellsCommand from './commands/mergecellscommand';
 import { findAncestor } from './commands/utils';
 import TableUtils from '../src/tableutils';
 
@@ -132,8 +131,6 @@ export default class TableEditing extends Plugin {
 		editor.commands.add( 'splitTableCellVertically', new SplitCellCommand( editor, { direction: 'vertically' } ) );
 		editor.commands.add( 'splitTableCellHorizontally', new SplitCellCommand( editor, { direction: 'horizontally' } ) );
 
-		editor.commands.add( 'mergeTableCells', new MergeCellsCommand( editor ) );
-
 		editor.commands.add( 'mergeTableCellRight', new MergeCellCommand( editor, { direction: 'right' } ) );
 		editor.commands.add( 'mergeTableCellLeft', new MergeCellCommand( editor, { direction: 'left' } ) );
 		editor.commands.add( 'mergeTableCellDown', new MergeCellCommand( editor, { direction: 'down' } ) );

+ 23 - 2
packages/ckeditor5-table/src/tableui.js

@@ -153,8 +153,29 @@ export default class TableUI extends Plugin {
 				{
 					type: 'button',
 					model: {
-						commandName: 'mergeTableCells',
-						label: t( 'Merge cells' )
+						commandName: 'mergeTableCellUp',
+						label: t( 'Merge cell up' )
+					}
+				},
+				{
+					type: 'button',
+					model: {
+						commandName: isContentLtr ? 'mergeTableCellRight' : 'mergeTableCellLeft',
+						label: t( 'Merge cell right' )
+					}
+				},
+				{
+					type: 'button',
+					model: {
+						commandName: 'mergeTableCellDown',
+						label: t( 'Merge cell down' )
+					}
+				},
+				{
+					type: 'button',
+					model: {
+						commandName: isContentLtr ? 'mergeTableCellLeft' : 'mergeTableCellRight',
+						label: t( 'Merge cell left' )
 					}
 				},
 				{ type: 'separator' },

+ 0 - 420
packages/ckeditor5-table/tests/commands/mergecellscommand.js

@@ -1,420 +0,0 @@
-/**
- * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
- */
-
-import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
-import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
-
-import MergeCellsCommand from '../../src/commands/mergecellscommand';
-import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
-import TableUtils from '../../src/tableutils';
-import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
-
-describe( 'MergeCellsCommand', () => {
-	let editor, model, command, root;
-
-	beforeEach( () => {
-		return ModelTestEditor
-			.create( {
-				plugins: [ TableUtils ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-				model = editor.model;
-				root = model.document.getRoot( 'main' );
-
-				command = new MergeCellsCommand( editor );
-
-				defaultSchema( model.schema );
-				defaultConversion( editor.conversion );
-			} );
-	} );
-
-	afterEach( () => {
-		return editor.destroy();
-	} );
-
-	describe( 'isEnabled', () => {
-		it( 'should be false if collapsed selection in table cell', () => {
-			setData( model, modelTable( [
-				[ '00[]', '01' ]
-			] ) );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be false if only one table cell is selected', () => {
-			setData( model, modelTable( [
-				[ '00', '01' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ] ] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be true if at least two adjacent table cells are selected', () => {
-			setData( model, modelTable( [
-				[ '00', '01' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ], [ 0, 0, 1 ] ] );
-
-			expect( command.isEnabled ).to.be.true;
-		} );
-
-		it( 'should be true if many table cells are selected', () => {
-			setData( model, modelTable( [
-				[ '00', '01', '02', '03' ],
-				[ '10', '11', '12', '13' ],
-				[ '20', '21', '22', '23' ],
-				[ '30', '31', '32', '33' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 1 ], [ 0, 0, 2 ],
-				[ 0, 1, 1 ], [ 0, 1, 2 ],
-				[ 0, 2, 1 ], [ 0, 2, 2 ],
-				[ 0, 3, 1 ], [ 0, 3, 2 ]
-			] );
-
-			expect( command.isEnabled ).to.be.true;
-		} );
-
-		it( 'should be false if at least one table cell is not selected from an area', () => {
-			setData( model, modelTable( [
-				[ '00', '01', '02', '03' ],
-				[ '10', '11', '12', '13' ],
-				[ '20', '21', '22', '23' ],
-				[ '30', '31', '32', '33' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 1 ], [ 0, 0, 2 ],
-				[ 0, 1, 2 ], // one table cell not selected from this row
-				[ 0, 2, 1 ], [ 0, 2, 2 ],
-				[ 0, 3, 1 ], [ 0, 3, 2 ]
-			] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be false if table cells are not in adjacent rows', () => {
-			setData( model, modelTable( [
-				[ '00', '01' ],
-				[ '10', '11' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 1, 0 ],
-				[ 0, 0, 1 ]
-			] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be false if table cells are not in adjacent columns', () => {
-			setData( model, modelTable( [
-				[ '00', '01', '02' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ], [ 0, 0, 2 ] ] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be false if any range is collapsed in selection', () => {
-			setData( model, modelTable( [
-				[ '00', '01', '02' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 0, 0, 0 ], // The "00" text node
-				[ 0, 0, 1 ]
-			] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be false if any ranges are on different tables', () => {
-			setData( model,
-				modelTable( [ [ '00', '01' ] ] ) +
-				modelTable( [ [ 'aa', 'ab' ] ] )
-			);
-
-			selectNodes( [
-				[ 0, 0, 0 ], // first table
-				[ 1, 0, 1 ] // second table
-			] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be false if any table cell with colspan attribute extends over selection area', () => {
-			setData( model, modelTable( [
-				[ '00', { colspan: 2, contents: '01' } ],
-				[ '10', '11', '12' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 0 ], [ 0, 0, 1 ],
-				[ 0, 1, 0 ], [ 0, 1, 1 ]
-			] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be true if none table cell with colspan attribute extends over selection area', () => {
-			setData( model, modelTable( [
-				[ '00', { colspan: 2, contents: '01' } ],
-				[ '10', '11', '12' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 0 ], [ 0, 0, 1 ],
-				[ 0, 1, 0 ], [ 0, 1, 1 ],
-				[ 0, 1, 2 ]
-			] );
-
-			expect( command.isEnabled ).to.be.true;
-		} );
-
-		it( 'should be true if first table cell is inside selection area', () => {
-			setData( model, modelTable( [
-				[ { colspan: 2, rowspan: 2, contents: '00' }, '02', '03' ],
-				[ '12', '13' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 0 ], [ 0, 0, 1 ],
-				[ 0, 1, 0 ]
-			] );
-
-			expect( command.isEnabled ).to.be.true;
-		} );
-
-		it( 'should be false if any table cell with rowspan attribute extends over selection area', () => {
-			setData( model, modelTable( [
-				[ '00', { rowspan: 2, contents: '01' } ],
-				[ '10' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ], [ 0, 0, 1 ] ] );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-
-		it( 'should be true if none table cell with rowspan attribute extends over selection area', () => {
-			setData( model, modelTable( [
-				[ '00', { rowspan: 2, contents: '01' } ],
-				[ '10' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 0 ], [ 0, 0, 1 ],
-				[ 0, 1, 0 ]
-			] );
-
-			expect( command.isEnabled ).to.be.true;
-		} );
-
-		it( 'should be false if not in a cell', () => {
-			setData( model, '<paragraph>11[]</paragraph>' );
-
-			expect( command.isEnabled ).to.be.false;
-		} );
-	} );
-
-	describe( 'execute()', () => {
-		it( 'should merge table cells', () => {
-			setData( model, modelTable( [
-				[ '[]00', '01' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 0 ], [ 0, 0, 1 ]
-			] );
-
-			command.execute();
-
-			assertEqualMarkup( getData( model ), modelTable( [
-				[ { colspan: 2, contents: '<paragraph>[00</paragraph><paragraph>01]</paragraph>' } ]
-			] ) );
-		} );
-
-		it( 'should merge table cells - extend colspan attribute', () => {
-			setData( model, modelTable( [
-				[ { colspan: 2, contents: '00' }, '02', '03' ],
-				[ '10', '11', '12', '13' ]
-			] ) );
-
-			selectNodes( [
-				[ 0, 0, 0 ], [ 0, 0, 1 ],
-				[ 0, 1, 0 ], [ 0, 1, 1 ], [ 0, 1, 2 ]
-			] );
-
-			command.execute();
-
-			assertEqualMarkup( getData( model ), modelTable( [
-				[ {
-					colspan: 3,
-					rowspan: 2,
-					contents: '<paragraph>[00</paragraph>' +
-						'<paragraph>02</paragraph>' +
-						'<paragraph>10</paragraph>' +
-						'<paragraph>11</paragraph>' +
-						'<paragraph>12]</paragraph>'
-				}, '03' ],
-				[ '13' ]
-			] ) );
-		} );
-
-		it( 'should merge to a single paragraph - every cell is empty', () => {
-			setData( model, modelTable( [
-				[ '[]', '' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ], [ 0, 0, 1 ] ] );
-
-			command.execute();
-
-			assertEqualMarkup( getData( model ), modelTable( [
-				[ { colspan: 2, contents: '<paragraph>[]</paragraph>' } ]
-			] ) );
-		} );
-
-		it( 'should merge to a single paragraph - merged cell is empty', () => {
-			setData( model, modelTable( [
-				[ 'foo', '' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ], [ 0, 0, 1 ] ] );
-
-			command.execute();
-
-			assertEqualMarkup( getData( model ), modelTable( [
-				[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
-			] ) );
-		} );
-
-		it( 'should merge to a single paragraph - cell to which others are merged is empty', () => {
-			setData( model, modelTable( [
-				[ '', 'foo' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ], [ 0, 0, 1 ] ] );
-
-			command.execute();
-
-			assertEqualMarkup( getData( model ), modelTable( [
-				[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
-			] ) );
-		} );
-
-		it( 'should not merge empty blocks other then <paragraph> to a single block', () => {
-			model.schema.register( 'block', {
-				allowWhere: '$block',
-				allowContentOf: '$block',
-				isBlock: true
-			} );
-
-			setData( model, modelTable( [
-				[ '<block>[]</block>', '<block></block>' ]
-			] ) );
-
-			selectNodes( [ [ 0, 0, 0 ], [ 0, 0, 1 ] ] );
-
-			command.execute();
-
-			assertEqualMarkup( getData( model ), modelTable( [
-				[ { colspan: 2, contents: '<block>[</block><block>]</block>' } ]
-			] ) );
-		} );
-
-		describe( 'removing empty row', () => {
-			it( 'should remove empty row if merging all table cells from that row', () => {
-				setData( model, modelTable( [
-					[ '00' ],
-					[ '10' ],
-					[ '20' ]
-				] ) );
-
-				selectNodes( [
-					[ 0, 0, 0 ],
-					[ 0, 1, 0 ],
-					[ 0, 2, 0 ]
-				] );
-
-				command.execute();
-
-				assertEqualMarkup( getData( model ), modelTable( [
-					[
-						'<paragraph>[00</paragraph><paragraph>10</paragraph><paragraph>20]</paragraph>'
-					]
-				] ) );
-			} );
-
-			it( 'should decrease rowspan if cell overlaps removed row', () => {
-				setData( model, modelTable( [
-					[ '00', { rowspan: 2, contents: '01' }, { rowspan: 3, contents: '02' } ],
-					[ '10' ],
-					[ '20', '21' ]
-				] ) );
-
-				selectNodes( [
-					[ 0, 0, 0 ],
-					[ 0, 1, 0 ],
-					[ 0, 2, 0 ]
-				] );
-
-				command.execute();
-
-				assertEqualMarkup( getData( model ), modelTable( [
-					[
-						{ rowspan: 2, contents: '<paragraph>[00</paragraph><paragraph>10</paragraph><paragraph>20]</paragraph>' },
-						'01',
-						{ rowspan: 2, contents: '02' }
-					],
-					[ '21' ]
-				] ) );
-			} );
-
-			it( 'should not decrease rowspan if cell from previous row does not overlaps removed row', () => {
-				setData( model, modelTable( [
-					[ '00', { rowspan: 2, contents: '01' } ],
-					[ '10' ],
-					[ '20', '21' ],
-					[ '30', '31' ]
-				] ) );
-
-				selectNodes( [
-					[ 0, 2, 0 ], [ 0, 2, 1 ],
-					[ 0, 3, 0 ], [ 0, 3, 1 ]
-				] );
-
-				command.execute();
-
-				assertEqualMarkup( getData( model ), modelTable( [
-					[ '00', { rowspan: 2, contents: '01' } ],
-					[ '10' ],
-					[
-						{
-							colspan: 2,
-							contents: '<paragraph>[20</paragraph><paragraph>21</paragraph>' +
-								'<paragraph>30</paragraph><paragraph>31]</paragraph>'
-						}
-					]
-				] ) );
-			} );
-		} );
-	} );
-
-	function selectNodes( paths ) {
-		model.change( writer => {
-			const ranges = paths.map( path => writer.createRangeOn( root.getNodeByPath( path ) ) );
-
-			writer.setSelection( ranges );
-		} );
-	}
-} );

+ 0 - 5
packages/ckeditor5-table/tests/tableediting.js

@@ -17,7 +17,6 @@ import InsertColumnCommand from '../src/commands/insertcolumncommand';
 import RemoveRowCommand from '../src/commands/removerowcommand';
 import RemoveColumnCommand from '../src/commands/removecolumncommand';
 import SplitCellCommand from '../src/commands/splitcellcommand';
-import MergeCellsCommand from '../src/commands/mergecellscommand';
 import SetHeaderRowCommand from '../src/commands/setheaderrowcommand';
 import SetHeaderColumnCommand from '../src/commands/setheadercolumncommand';
 import MediaEmbedEditing from '@ckeditor/ckeditor5-media-embed/src/mediaembedediting';
@@ -119,10 +118,6 @@ describe( 'TableEditing', () => {
 		expect( editor.commands.get( 'splitTableCellHorizontally' ) ).to.be.instanceOf( SplitCellCommand );
 	} );
 
-	it( 'adds mergeTableCells command', () => {
-		expect( editor.commands.get( 'mergeTableCells' ) ).to.be.instanceOf( MergeCellsCommand );
-	} );
-
 	it( 'adds setColumnHeader command', () => {
 		expect( editor.commands.get( 'setTableColumnHeader' ) ).to.be.instanceOf( SetHeaderColumnCommand );
 	} );