UNPKG

1.73 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2023, 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/insertcolumncommand
7 */
8import { Command, type Editor } from 'ckeditor5/src/core';
9/**
10 * The insert column command.
11 *
12 * The command is registered by {@link module:table/tableediting~TableEditing} as the `'insertTableColumnLeft'` and
13 * `'insertTableColumnRight'` editor commands.
14 *
15 * To insert a column to the left of the selected cell, execute the following command:
16 *
17 * ```ts
18 * editor.execute( 'insertTableColumnLeft' );
19 * ```
20 *
21 * To insert a column to the right of the selected cell, execute the following command:
22 *
23 * ```ts
24 * editor.execute( 'insertTableColumnRight' );
25 * ```
26 */
27export default class InsertColumnCommand extends Command {
28 /**
29 * The order of insertion relative to the column in which the caret is located.
30 */
31 readonly order: 'left' | 'right';
32 /**
33 * Creates a new `InsertColumnCommand` instance.
34 *
35 * @param editor An editor on which this command will be used.
36 * @param options.order The order of insertion relative to the column in which the caret is located.
37 * Possible values: `"left"` and `"right"`. Default value is "right".
38 */
39 constructor(editor: Editor, options?: {
40 order?: 'left' | 'right';
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 column to the `'left'` or `'right'` of the column
50 * in which the selection is set.
51 *
52 * @fires execute
53 */
54 execute(): void;
55}