UNPKG

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