UNPKG

1.37 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/splitcellcommand
7 */
8import { Command, type Editor } from 'ckeditor5/src/core';
9/**
10 * The split cell command.
11 *
12 * The command is registered by {@link module:table/tableediting~TableEditing} as the `'splitTableCellVertically'`
13 * and `'splitTableCellHorizontally'` editor commands.
14 *
15 * You can split any cell vertically or horizontally by executing this command. For example, to split the selected table cell vertically:
16 *
17 * ```ts
18 * editor.execute( 'splitTableCellVertically' );
19 * ```
20 */
21export default class SplitCellCommand extends Command {
22 /**
23 * The direction that indicates which cell will be split.
24 */
25 readonly direction: 'horizontally' | 'vertically';
26 /**
27 * Creates a new `SplitCellCommand` instance.
28 *
29 * @param editor The editor on which this command will be used.
30 * @param options.direction Indicates whether the command should split cells `'horizontally'` or `'vertically'`.
31 */
32 constructor(editor: Editor, options?: {
33 direction?: 'horizontally' | 'vertically';
34 });
35 /**
36 * @inheritDoc
37 */
38 refresh(): void;
39 /**
40 * @inheritDoc
41 */
42 execute(): void;
43}