8
0
Pārlūkot izejas kodu

Docs (table): API docs for tables improved. [skip ci]

Anna Tomanek 5 gadi atpakaļ
vecāks
revīzija
a488d5e60a

+ 2 - 2
packages/ckeditor5-table/lang/contexts.json

@@ -4,13 +4,13 @@
 	"Insert column left": "Label for the insert table column to the left of the current one button.",
 	"Insert column right": "Label for the insert table column to the right of the current one button.",
 	"Delete column": "Label for the delete table column button.",
-	"Select column": "Label for the select table entire column button.",
+	"Select column": "Label for the select the entire table column button.",
 	"Column": "Label for the table column dropdown button.",
 	"Header row": "Label for the set/unset table header row button.",
 	"Insert row below": "Label for the insert row below button.",
 	"Insert row above": "Label for the insert row above button.",
 	"Delete row": "Label for the delete table row button.",
-	"Select row": "Label for the select table entire row button.",
+	"Select row": "Label for the select the entire table row button.",
 	"Row": "Label for the table row dropdown button.",
 	"Merge cell up": "Label for the merge table cell up button.",
 	"Merge cell right": "Label for the merge table cell right button.",

+ 1 - 1
packages/ckeditor5-table/src/commands/mergecellcommand.js

@@ -264,7 +264,7 @@ function removeEmptyRow( removedTableCellRow, writer ) {
 }
 
 // Merges two table cells. It will ensure that after merging cells with an empty paragraph, the resulting table cell will only have one
-// paragraph. If one of the merged table cell is empty, the merged table cell will have the contents of the non-empty table cell.
+// paragraph. If one of the merged table cells is empty, the merged table cell will have the 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

+ 10 - 10
packages/ckeditor5-table/src/commands/mergecellscommand.js

@@ -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.

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

@@ -139,7 +139,7 @@ export function getSelectionAffectedTableCells( selection ) {
 }
 
 /**
- * Returns an object with `first` and `last` row index contained in the given `tableCells`.
+ * Returns an object with the `first` and `last` row index contained in the given `tableCells`.
  *
  *		const selectedTableCells = getSelectedTableCells( editor.model.document.selection );
  *
@@ -148,7 +148,7 @@ export function getSelectionAffectedTableCells( selection ) {
  *		console.log( `Selected rows: ${ first } to ${ last }` );
  *
  * @param {Array.<module:engine/model/element~Element>} tableCells
- * @returns {Object} Returns an object with `first` and `last` table row indexes.
+ * @returns {Object} Returns an object with the `first` and `last` table row indexes.
  */
 export function getRowIndexes( tableCells ) {
 	const indexes = tableCells.map( cell => cell.parent.index );
@@ -157,7 +157,7 @@ export function getRowIndexes( tableCells ) {
 }
 
 /**
- * Returns an object with `first` and `last` column index contained in the given `tableCells`.
+ * Returns an object with the `first` and `last` column index contained in the given `tableCells`.
  *
  *		const selectedTableCells = getSelectedTableCells( editor.model.document.selection );
  *
@@ -166,7 +166,7 @@ export function getRowIndexes( tableCells ) {
  *		console.log( `Selected columns: ${ first } to ${ last }` );
  *
  * @param {Array.<module:engine/model/element~Element>} tableCells
- * @returns {Object} Returns an object with `first` and `last` table column indexes.
+ * @returns {Object} Returns an object with the `first` and `last` table column indexes.
  */
 export function getColumnIndexes( tableCells ) {
 	const table = findAncestor( 'table', tableCells[ 0 ] );