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