UNPKG

1.66 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module table/commands/insertrowcommand
7 */
8import { Command, type Editor } from 'ckeditor5/src/core.js';
9/**
10 * The insert row command.
11 *
12 * The command is registered by {@link module:table/tableediting~TableEditing} as the `'insertTableRowBelow'` and
13 * `'insertTableRowAbove'` editor commands.
14 *
15 * To insert a row below the selected cell, execute the following command:
16 *
17 * ```ts
18 * editor.execute( 'insertTableRowBelow' );
19 * ```
20 *
21 * To insert a row above the selected cell, execute the following command:
22 *
23 * ```ts
24 * editor.execute( 'insertTableRowAbove' );
25 * ```
26 */
27export default class InsertRowCommand extends Command {
28 /**
29 * The order of insertion relative to the row in which the caret is located.
30 */
31 readonly order: 'above' | 'below';
32 /**
33 * Creates a new `InsertRowCommand` instance.
34 *
35 * @param editor The editor on which this command will be used.
36 * @param options.order The order of insertion relative to the row in which the caret is located.
37 * Possible values: `"above"` and `"below"`. Default value is "below"
38 */
39 constructor(editor: Editor, options?: {
40 order?: 'above' | 'below';
41 });
42 /**
43 * @inheritDoc
44 */
45 refresh(): void;
46 /**
47 * Executes the command.
48 *
49 * Depending on the command's {@link #order} value, it inserts a row `'below'` or `'above'` the row in which selection is set.
50 *
51 * @fires execute
52 */
53 execute(): void;
54}