|
|
@@ -16,7 +16,7 @@ import { getColumnIndexes, getRowIndexes, getSelectedTableCells } from '../utils
|
|
|
/**
|
|
|
* The merge cells command.
|
|
|
*
|
|
|
- * The command is registered by the {@link module:table/tableediting~TableEditing} as `'mergeTableCells'` editor command.
|
|
|
+ * The command is registered by {@link module:table/tableediting~TableEditing} as the `'mergeTableCells'` editor command.
|
|
|
*
|
|
|
* For example, to merge selected table cells:
|
|
|
*
|
|
|
@@ -44,7 +44,7 @@ export default class MergeCellsCommand extends Command {
|
|
|
model.change( writer => {
|
|
|
const selectedTableCells = getSelectedTableCells( model.document.selection );
|
|
|
|
|
|
- // All cells will be merge into the first one.
|
|
|
+ // All cells will be merged into the first one.
|
|
|
const firstTableCell = selectedTableCells.shift();
|
|
|
|
|
|
// Set the selection in cell that other cells are being merged to prevent model-selection-range-intersects error in undo.
|
|
|
@@ -68,7 +68,7 @@ export default class MergeCellsCommand extends Command {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// Properly removes the empty row from a table. Updates the `rowspan` attribute of cells that overlap the removed row.
|
|
|
+// Properly removes an empty row from a table. Updates the `rowspan` attribute of cells that overlap the removed row.
|
|
|
//
|
|
|
// @param {module:engine/model/element~Element} row
|
|
|
// @param {module:engine/model/writer~Writer} writer
|
|
|
@@ -91,8 +91,8 @@ function removeRowIfEmpty( row, writer ) {
|
|
|
writer.remove( row );
|
|
|
}
|
|
|
|
|
|
-// Merges two table cells - will ensure that after merging cells with empty paragraphs the result table cell will only have one paragraph.
|
|
|
-// If one of the merged table cells is empty, the merged table cell will have contents of the non-empty table cell.
|
|
|
+// Merges two table cells. It will ensure that after merging cells with empty paragraphs the resulting table cell will only have one
|
|
|
+// paragraph. If one of the merged table cells 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} cellBeingMerged
|
|
|
@@ -119,7 +119,7 @@ function isEmpty( tableCell ) {
|
|
|
return tableCell.childCount == 1 && tableCell.getChild( 0 ).is( 'paragraph' ) && tableCell.getChild( 0 ).isEmpty;
|
|
|
}
|
|
|
|
|
|
-// Checks if the selection contains mergeable cells.
|
|
|
+// Checks if the selection contains cells that can be merged.
|
|
|
//
|
|
|
// In a table below:
|
|
|
//
|
|
|
@@ -138,8 +138,8 @@ function isEmpty( tableCell ) {
|
|
|
// - c, d, f (cell d spans over a cell in the row below)
|
|
|
//
|
|
|
// While an 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)
|
|
|
+// - a, c (the unselected cell "b" creates a gap)
|
|
|
+// - f, g, h (cell "d" spans over a cell from the row of "f" cell - thus creates a gap)
|
|
|
//
|
|
|
// @param {module:engine/model/selection~Selection} selection
|
|
|
// @param {module:table/tableUtils~TableUtils} tableUtils
|
|
|
@@ -187,7 +187,7 @@ function canMergeCells( selection, tableUtils ) {
|
|
|
return areaOfValidSelection == areaOfSelectedCells;
|
|
|
}
|
|
|
|
|
|
-// Calculates the area of a maximum rectangle that can span over provided row & column indexes.
|
|
|
+// Calculates the area of a maximum rectangle that can span over the provided row & column indexes.
|
|
|
//
|
|
|
// @param {Array.<Number>} rows
|
|
|
// @param {Array.<Number>} columns
|
|
|
@@ -204,7 +204,7 @@ function getBiggestRectangleArea( rows, columns ) {
|
|
|
return ( lastRow - firstRow + 1 ) * ( lastColumn - firstColumn + 1 );
|
|
|
}
|
|
|
|
|
|
-// Checks if the selection does not mix header (column or row) with other cells.
|
|
|
+// Checks if the selection does not mix a header (column or row) with other cells.
|
|
|
//
|
|
|
// For instance, in the table below valid selections consist of cells with the same letter only.
|
|
|
// So, a-a (same heading row and column) or d-d (body cells) are valid while c-d or a-b are not.
|