8
0
Просмотр исходного кода

Use standard library for basic mathematical operations.

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
93b3bc9535
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      packages/ckeditor5-table/src/tableselection.js

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

@@ -206,11 +206,11 @@ export default class TableSelection extends Plugin {
 		const startLocation = this._tableUtils.getCellLocation( this._startElement );
 		const endLocation = this._tableUtils.getCellLocation( this._endElement );
 
-		const startRow = startLocation.row > endLocation.row ? endLocation.row : startLocation.row;
-		const endRow = startLocation.row > endLocation.row ? startLocation.row : endLocation.row;
+		const startRow = Math.min( startLocation.row, endLocation.row );
+		const endRow = Math.max( startLocation.row, endLocation.row );
 
-		const startColumn = startLocation.column > endLocation.column ? endLocation.column : startLocation.column;
-		const endColumn = startLocation.column > endLocation.column ? startLocation.column : endLocation.column;
+		const startColumn = Math.min( startLocation.column, endLocation.column );
+		const endColumn = Math.max( startLocation.column, endLocation.column );
 
 		for ( const cellInfo of new TableWalker( this._startElement.parent.parent, { startRow, endRow } ) ) {
 			if ( cellInfo.column >= startColumn && cellInfo.column <= endColumn ) {