1 |
|
2 |
|
3 |
|
4 |
|
5 | import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
6 | import ImageResizeEditing from './imageresizeediting.js';
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export default class ImageResizeButtons extends Plugin {
|
13 | |
14 |
|
15 |
|
16 | static get requires(): readonly [typeof ImageResizeEditing];
|
17 | |
18 |
|
19 |
|
20 | static get pluginName(): "ImageResizeButtons";
|
21 | |
22 |
|
23 |
|
24 |
|
25 | private readonly _resizeUnit;
|
26 | |
27 |
|
28 |
|
29 | constructor(editor: Editor);
|
30 | /**
|
31 | * @inheritDoc
|
32 | */
|
33 | init(): void;
|
34 | /**
|
35 | * A helper function that creates a standalone button component for the plugin.
|
36 | *
|
37 | * @param resizeOption A model of the resize option.
|
38 | */
|
39 | private _registerImageResizeButton;
|
40 | /**
|
41 | * A helper function that creates a dropdown component for the plugin containing all the resize options defined in
|
42 | * the editor configuration.
|
43 | *
|
44 | * @param options An array of configured options.
|
45 | */
|
46 | private _registerImageResizeDropdown;
|
47 | /**
|
48 | * A helper function for creating an option label value string.
|
49 | *
|
50 | * @param option A resize option object.
|
51 | * @param forTooltip An optional flag for creating a tooltip label.
|
52 | * @returns A user-defined label combined from the numeric value and the resize unit or the default label
|
53 | * for reset options (`Original`).
|
54 | */
|
55 | private _getOptionLabelValue;
|
56 | /**
|
57 | * A helper function that parses the resize options and returns list item definitions ready for use in the dropdown.
|
58 | *
|
59 | * @param options The resize options.
|
60 | * @param command The resize image command.
|
61 | * @returns Dropdown item definitions.
|
62 | */
|
63 | private _getResizeDropdownListItemDefinitions;
|
64 | }
|