UNPKG

1.69 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/inserttablecommand
7 */
8import { Command } from 'ckeditor5/src/core.js';
9/**
10 * The insert table command.
11 *
12 * The command is registered by {@link module:table/tableediting~TableEditing} as the `'insertTable'` editor command.
13 *
14 * To insert a table at the current selection, execute the command and specify the dimensions:
15 *
16 * ```ts
17 * editor.execute( 'insertTable', { rows: 20, columns: 5 } );
18 * ```
19 */
20export default class InsertTableCommand extends Command {
21 /**
22 * @inheritDoc
23 */
24 refresh(): void;
25 /**
26 * Executes the command.
27 *
28 * Inserts a table with the given number of rows and columns into the editor.
29 *
30 * @param options.rows The number of rows to create in the inserted table. Default value is 2.
31 * @param options.columns The number of columns to create in the inserted table. Default value is 2.
32 * @param options.headingRows The number of heading rows. If not provided it will default to
33 * {@link module:table/tableconfig~TableConfig#defaultHeadings `config.table.defaultHeadings.rows`} table config.
34 * @param options.headingColumns The number of heading columns. If not provided it will default to
35 * {@link module:table/tableconfig~TableConfig#defaultHeadings `config.table.defaultHeadings.columns`} table config.
36 * @fires execute
37 */
38 execute(options?: {
39 rows?: number;
40 columns?: number;
41 headingRows?: number;
42 headingColumns?: number;
43 }): void;
44}