UNPKG

1.59 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/tableproperties/commands/tableborderwidthcommand
7 */
8import type { Element } from 'ckeditor5/src/engine.js';
9import type { Editor } from 'ckeditor5/src/core.js';
10import TablePropertyCommand from './tablepropertycommand.js';
11/**
12 * The table width border command.
13 *
14 * The command is registered by the {@link module:table/tableproperties/tablepropertiesediting~TablePropertiesEditing} as
15 * the `'tableBorderWidth'` editor command.
16 *
17 * To change the border width of the selected table, execute the command:
18 *
19 * ```ts
20 * editor.execute( 'tableBorderWidth', {
21 * value: '5px'
22 * } );
23 * ```
24 *
25 * **Note**: This command adds the default `'px'` unit to numeric values. Executing:
26 *
27 * ```ts
28 * editor.execute( 'tableBorderWidth', {
29 * value: '5'
30 * } );
31 * ```
32 *
33 * will set the `borderWidth` attribute to `'5px'` in the model.
34 */
35export default class TableBorderWidthCommand extends TablePropertyCommand {
36 /**
37 * Creates a new `TableBorderWidthCommand` instance.
38 *
39 * @param editor An editor in which this command will be used.
40 * @param defaultValue The default value of the attribute.
41 */
42 constructor(editor: Editor, defaultValue: string);
43 /**
44 * @inheritDoc
45 */
46 protected _getValue(table: Element): string | undefined;
47 /**
48 * @inheritDoc
49 */
50 protected _getValueToSet(value: string | number | undefined): unknown;
51}