1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { Command, type Editor } from 'ckeditor5/src/core.js';
|
9 | import type { Element, Batch } from 'ckeditor5/src/engine.js';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export default class TableCellPropertyCommand extends Command {
|
16 | |
17 |
|
18 |
|
19 | readonly attributeName: string;
|
20 | |
21 |
|
22 |
|
23 | protected readonly _defaultValue: string;
|
24 | |
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | constructor(editor: Editor, attributeName: string, defaultValue: string);
|
32 | /**
|
33 | * @inheritDoc
|
34 | */
|
35 | refresh(): void;
|
36 | /**
|
37 | * Executes the command.
|
38 | *
|
39 | * @fires execute
|
40 | * @param options.value If set, the command will set the attribute on selected table cells.
|
41 | * If it is not set, the command will remove the attribute from the selected table cells.
|
42 | * @param options.batch Pass the model batch instance to the command to aggregate changes,
|
43 | * for example to allow a single undo step for multiple executions.
|
44 | */
|
45 | execute(options?: {
|
46 | value?: string | number;
|
47 | batch?: Batch;
|
48 | }): void;
|
49 | /**
|
50 | * Returns the attribute value for a table cell.
|
51 | */
|
52 | protected _getAttribute(tableCell: Element | undefined): unknown;
|
53 | /**
|
54 | * Returns the proper model value. It can be used to add a default unit to numeric values.
|
55 | */
|
56 | protected _getValueToSet(value: string | number | undefined): unknown;
|
57 | /**
|
58 | * Returns a single value for all selected table cells. If the value is the same for all cells,
|
59 | * it will be returned (`undefined` otherwise).
|
60 | */
|
61 | private _getSingleValue;
|
62 | }
|