UNPKG

1.84 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/setheadercolumncommand
7 */
8import { Command } from 'ckeditor5/src/core';
9/**
10 * The header column command.
11 *
12 * The command is registered by {@link module:table/tableediting~TableEditing} as the `'setTableColumnHeader'` editor command.
13 *
14 * You can make the column containing the selected cell a [header](https://www.w3.org/TR/html50/tabular-data.html#the-th-element)
15 * by executing:
16 *
17 * ```ts
18 * editor.execute( 'setTableColumnHeader' );
19 * ```
20 *
21 * **Note:** All preceding columns will also become headers. If the current column is already a header, executing this command
22 * will make it a regular column back again (including the following columns).
23 */
24export default class SetHeaderColumnCommand extends Command {
25 /**
26 * Flag indicating whether the command is active. The command is active when the
27 * {@link module:engine/model/selection~Selection} is in a header column.
28 *
29 * @observable
30 */
31 value: boolean;
32 /**
33 * @inheritDoc
34 */
35 refresh(): void;
36 /**
37 * Executes the command.
38 *
39 * When the selection is in a non-header column, the command will set the `headingColumns` table attribute to cover that column.
40 *
41 * When the selection is already in a header column, it will set `headingColumns` so the heading section will end before that column.
42 *
43 * @fires execute
44 * @param options.forceValue If set, the command will set (`true`) or unset (`false`) the header columns according to
45 * the `forceValue` parameter instead of the current model state.
46 */
47 execute(options?: {
48 forceValue?: boolean;
49 }): void;
50}