Преглед на файлове

Use removeRow() method from TableUtils.

Maciej Gołaszewski преди 5 години
родител
ревизия
d7542b0376
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4 2
      packages/ckeditor5-table/src/commands/removecolumncommand.js

+ 4 - 2
packages/ckeditor5-table/src/commands/removecolumncommand.js

@@ -92,7 +92,9 @@ export default class RemoveColumnCommand extends Command {
 	 * @param {module:engine/model/writer~Writer} writer
 	 */
 	_removeColumn( removedColumnIndex, table, writer ) {
-		for ( const { cell, column, colspan } of new TableWalker( table ) ) {
+		const tableUtils = this.editor.plugins.get( 'TableUtils' );
+
+		for ( const { cell, column, colspan } of [ ...new TableWalker( table ) ] ) {
 			// If colspaned cell overlaps removed column decrease its span.
 			if ( column <= removedColumnIndex && colspan > 1 && column + colspan > removedColumnIndex ) {
 				updateNumericAttribute( 'colspan', colspan - 1, cell, writer );
@@ -105,7 +107,7 @@ export default class RemoveColumnCommand extends Command {
 				// If the cell was the last one in the row, get rid of the entire row.
 				// https://github.com/ckeditor/ckeditor5/issues/6429
 				if ( !cellRow.childCount ) {
-					writer.remove( cellRow );
+					tableUtils.removeRow( cellRow.index, table, writer );
 				}
 			}
 		}