8
0
Pārlūkot izejas kodu

Docs: Improve common API section of a table feature guide.

Maciej Gołaszewski 7 gadi atpakaļ
vecāks
revīzija
8e479de5a8

+ 15 - 89
packages/ckeditor5-table/docs/features/table.md

@@ -52,95 +52,21 @@ The {@link module:table/table~Table} plugin registers the following UI component
 
 And the following commands:
 
-* The {@link module:table/commands/inserttablecommand~InsertTableCommand `'insertTable'`} command.
-
-	To insert a table at the current selection, execute the command and specify the dimensions:
-
-	```js
-	editor.execute( 'insertTable', { rows: 20, columns: 5 } );
-	```
-
-* The {@link module:table/commands/insertcolumncommand~InsertColumnCommand} in a form of `'insertTableColumnBefore'` and `'insertTableColumnAfter'` commands.
-
-	To insert a column before the selected cell, execute the following command:
-
-	```js
-	editor.execute( 'insertTableColumnBefore' );
-	```
-
-	To insert a column after the selected cell, execute the following command:
-
-	```js
-	editor.execute( 'insertTableColumnAfter' );
-	```
-
-* The {@link module:table/commands/insertrowcommand~InsertRowCommand} in a form of `'insertTableRowAbove'` and `'insertTableRowBelow'` commands.
-
-	To insert a row below the selected cell, execute the following command:
-
-	```js
-	editor.execute( 'insertTableRowBelow' );
-	```
-
-	To insert a row above the selected cell, execute the following command:
-
-	```js
-	editor.execute( 'insertTableRowAbove' );
-	```
-
-* The {@link module:table/commands/removecolumncommand~RemoveColumnCommand `'removeTableColumn'`} command.
-
-	To remove the column containing the selected cell, execute the command:
-
-	```js
-	editor.execute( 'removeTableColumn' );
-	```
-
-* The {@link module:table/commands/removerowcommand~RemoveRowCommand `'removeTableRow'`} command.
-
-	To remove the row containing the selected cell, execute the command:
-
-	```js
-	editor.execute( 'removeTableRow' );
-	```
-
-* The {@link module:table/commands/setheadercolumncommand~SetHeaderColumnCommand `'setTableColumnHeader'`} command.
-
-	You can make the column containing the selected cell a [header](https://www.w3.org/TR/html50/tabular-data.html#the-th-element) by executing:
-
-	```js
-	editor.execute( 'setTableColumnHeader' );
-	```
-
-	**Note:** All preceding columns will also become headers. If the current column is already a header, executing this command will make it a regular column back again (including the following columns).
-
-* The {@link module:table/commands/setheaderrowcommand~SetHeaderRowCommand `'setTableRowHeader'`} command.
-
-	You can make the row containing the selected cell a [header](https://www.w3.org/TR/html50/tabular-data.html#the-th-element) by executing:
-
-	```js
-	editor.execute( 'setTableRowHeader' );
-	```
-
-	**Note:** All preceding rows will also become headers. If the current row is already a header, executing this command will make it a regular row back again (including the following rows).
-
-* The {@link module:table/commands/mergecellcommand~MergeCellCommand} in a form of `'mergeTableCellRight'`, `'mergeTableCellLeft'`, `'mergeTableCellUp'` and `'mergeTableCellDown'` 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:
-
-	```js
-	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.
-
-* The {@link module:table/commands/splitcellcommand~SplitCellCommand} as `'splitTableCellVertically'` and `'splitTableCellHorizontally'` commands.
-
-	You can split any cell vertically or horizontally by executing this command. For example, to split the selected table cell vertically:
-
-	```js
-	editor.execute( 'splitTableCellVertically' );
-	```
+* The `'insertTable'` command implemented by {@link module:table/commands/inserttablecommand~InsertTableCommand}.
+* The `'insertTableColumnBefore'` command implemented by {@link module:table/commands/insertcolumncommand~InsertColumnCommand}.
+* The `'insertTableColumnAfter'` command implemented by {@link module:table/commands/insertcolumncommand~InsertColumnCommand}.
+* The `'insertTableRowAbove'` command implemented by {@link module:table/commands/insertrowcommand~InsertRowCommand}.
+* The `'insertTableRowBelow'` command implemented by {@link module:table/commands/insertrowcommand~InsertRowCommand}.
+* The `'removeTableColumn'` command implemented by {@link module:table/commands/removecolumncommand~RemoveColumnCommand}.
+* The `'removeTableRow'` command implemented by {@link module:table/commands/removerowcommand~RemoveRowCommand}.
+* The `'setTableColumnHeader'` command implemented by {@link module:table/commands/setheadercolumncommand~SetHeaderColumnCommand}.
+* The `'setTableRowHeader'` command implemented by {@link module:table/commands/setheaderrowcommand~SetHeaderRowCommand}.
+* The `'mergeTableCellRight'` command implemented by {@link module:table/commands/mergecellcommand~MergeCellCommand}.
+* The `'mergeTableCellLeft'` command implemented by {@link module:table/commands/mergecellcommand~MergeCellCommand}.
+* The `'mergeTableCellUp'` command implemented by {@link module:table/commands/mergecellcommand~MergeCellCommand}.
+* The `'mergeTableCellDown'` command implemented by {@link module:table/commands/mergecellcommand~MergeCellCommand}.
+* The `'splitTableCellVertically'` command implemented by {@link module:table/commands/splitcellcommand~SplitCellCommand}.
+* The `'splitTableCellHorizontally'` command implemented by {@link module:table/commands/splitcellcommand~SplitCellCommand}.
 
 The {@link module:table/tabletoolbar~TableToolbar} plugin introduces the balloon toolbar for tables. The toolbar shows up when a table cell is selected and is anchored to the table. It is possible to {@link module:table/table~TableConfig#toolbar configure} its content. Normally, it contains the table-related tools such as `'tableColumn'`, `'tableRow'`, and `'mergeTableCells'` dropdowns.
 

+ 11 - 0
packages/ckeditor5-table/src/commands/insertcolumncommand.js

@@ -14,6 +14,17 @@ import TableUtils from '../tableutils';
 /**
  * The insert column command.
  *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'insertTableColumnBefore'` and
+ * `'insertTableColumnAfter'` editor commands.
+ *
+ * To insert a column before the selected cell, execute the following command:
+ *
+ *		editor.execute( 'insertTableColumnBefore' );
+ *
+ * To insert a column after the selected cell, execute the following command:
+ *
+ *		editor.execute( 'insertTableColumnAfter' );
+ *
  * @extends module:core/command~Command
  */
 export default class InsertColumnCommand extends Command {

+ 11 - 0
packages/ckeditor5-table/src/commands/insertrowcommand.js

@@ -14,6 +14,17 @@ import TableUtils from '../tableutils';
 /**
  * The insert row command.
  *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'insertTableRowBelow'` and
+ * `'insertTableRowAbove'` editor commands.
+ *
+ * To insert a row below the selected cell, execute the following command:
+ *
+ *		editor.execute( 'insertTableRowBelow' );
+ *
+ * To insert a row above the selected cell, execute the following command:
+ *
+ *		editor.execute( 'insertTableRowAbove' );
+ *
  * @extends module:core/command~Command
  */
 export default class InsertRowCommand extends Command {

+ 6 - 0
packages/ckeditor5-table/src/commands/inserttablecommand.js

@@ -14,6 +14,12 @@ import TableUtils from '../tableutils';
 /**
  * The insert table command.
  *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'insertTable'` editor command.
+ *
+ * To insert a table at the current selection, execute the command and specify the dimensions:
+ *
+ *		editor.execute( 'insertTable', { rows: 20, columns: 5 } );
+ *
  * @extends module:core/command~Command
  */
 export default class InsertTableCommand extends Command {

+ 13 - 0
packages/ckeditor5-table/src/commands/mergecellcommand.js

@@ -15,6 +15,19 @@ import TableWalker from '../tablewalker';
 /**
  * The merge cell 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 MergeCellCommand extends Command {

+ 6 - 0
packages/ckeditor5-table/src/commands/removecolumncommand.js

@@ -16,6 +16,12 @@ import { updateNumericAttribute } from './utils';
 /**
  * The remove column command.
  *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'removeTableColumn'` editor command.
+ *
+ * To remove the column containing the selected cell, execute the command:
+ *
+ *		editor.execute( 'removeTableColumn' );
+ *
  * @extends module:core/command~Command
  */
 export default class RemoveColumnCommand extends Command {

+ 6 - 0
packages/ckeditor5-table/src/commands/removerowcommand.js

@@ -17,6 +17,12 @@ import { updateNumericAttribute } from './utils';
 /**
  * The remove row command.
  *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'removeTableRow'` editor command.
+ *
+ * To remove the row containing the selected cell, execute the command:
+ *
+ *		editor.execute( 'removeTableRow' );
+ *
  * @extends module:core/command~Command
  */
 export default class RemoveRowCommand extends Command {

+ 11 - 1
packages/ckeditor5-table/src/commands/setheadercolumncommand.js

@@ -12,7 +12,17 @@ import Command from '@ckeditor/ckeditor5-core/src/command';
 import { getParentTable, updateNumericAttribute } from './utils';
 
 /**
- * The header coloumn command.
+ * The header column command.
+ *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'setTableColumnHeader'` editor command.
+ *
+ * You can make the column containing the selected cell a [header](https://www.w3.org/TR/html50/tabular-data.html#the-th-element)
+ * by executing:
+ *
+ *		editor.execute( 'setTableColumnHeader' );
+ *
+ * **Note:** All preceding columns will also become headers. If the current column is already a header, executing this command
+ * will make it a regular column back again (including the following columns).
  *
  * @extends module:core/command~Command
  */

+ 9 - 0
packages/ckeditor5-table/src/commands/setheaderrowcommand.js

@@ -16,6 +16,15 @@ import TableWalker from '../tablewalker';
 /**
  * The header row command.
  *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'setTableColumnHeader'` editor command.
+ *
+ * You can make the row containing the selected cell a [header](https://www.w3.org/TR/html50/tabular-data.html#the-th-element) by executing:
+ *
+ *		editor.execute( 'setTableRowHeader' );
+ *
+ * **Note:** All preceding rows will also become headers. If the current row is already a header, executing this command
+ * will make it a regular row back again (including the following rows).
+ *
  * @extends module:core/command~Command
  */
 export default class SetHeaderRowCommand extends Command {

+ 7 - 0
packages/ckeditor5-table/src/commands/splitcellcommand.js

@@ -13,6 +13,13 @@ import TableUtils from '../tableutils';
 /**
  * The split cell command.
  *
+ * The command is registered by {@link module:table/tableediting~TableEditing} as `'splitTableCellVertically'`
+ * and `'splitTableCellHorizontally'`  editor commands.
+ *
+ * You can split any cell vertically or horizontally by executing this command. For example, to split the selected table cell vertically:
+ *
+ *		editor.execute( 'splitTableCellVertically' );
+ *
  * @extends module:core/command~Command
  */
 export default class SplitCellCommand extends Command {