UNPKG

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