UNPKG

1.07 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 image/imageresize/resizeimagecommand
7 */
8import { Command } from 'ckeditor5/src/core.js';
9/**
10 * The resize image command. Currently, it only supports the width attribute.
11 */
12export default class ResizeImageCommand extends Command {
13 /**
14 * Desired image width and height.
15 */
16 value: null | {
17 width: string | null;
18 height: string | null;
19 };
20 /**
21 * @inheritDoc
22 */
23 refresh(): void;
24 /**
25 * Executes the command.
26 *
27 * ```ts
28 * // Sets the width to 50%:
29 * editor.execute( 'resizeImage', { width: '50%' } );
30 *
31 * // Removes the width attribute:
32 * editor.execute( 'resizeImage', { width: null } );
33 * ```
34 *
35 * @param options
36 * @param options.width The new width of the image.
37 * @fires execute
38 */
39 execute(options: {
40 width: string | null;
41 }): void;
42}