@ckeditor/ckeditor5-widget 48.2.0 → 48.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/augmentation.d.ts +11 -11
- package/dist/highlightstack.d.ts +65 -64
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +2565 -3052
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +189 -189
- package/dist/verticalnavigation.d.ts +11 -11
- package/dist/widget.d.ts +113 -113
- package/dist/widgetresize/resizer.d.ts +166 -169
- package/dist/widgetresize/resizerstate.d.ts +122 -121
- package/dist/widgetresize/sizeview.d.ts +52 -52
- package/dist/widgetresize.d.ts +121 -121
- package/dist/widgettoolbarrepository.d.ts +96 -96
- package/dist/widgettypearound/utils.d.ts +35 -35
- package/dist/widgettypearound/widgettypearound.d.ts +226 -226
- package/package.json +8 -8
|
@@ -1,125 +1,126 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { WidgetResizerOptions } from '../widgetresize.js';
|
|
6
|
-
declare const WidgetResizeState_base: {
|
|
7
|
-
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
8
|
-
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
9
|
-
};
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
10
5
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
6
|
+
* @module widget/widgetresize/resizerstate
|
|
7
|
+
*/
|
|
8
|
+
import { type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
|
|
9
|
+
import type { WidgetResizerOptions } from "../widgetresize.js";
|
|
10
|
+
declare const WidgetResizeStateBase: ObservableMixinConstructor;
|
|
11
|
+
/**
|
|
12
|
+
* Stores the internal state of a single resizable object.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WidgetResizeState extends WidgetResizeStateBase {
|
|
15
|
+
/**
|
|
16
|
+
* The position of the handle that initiated the resizing. E.g. `"top-left"`, `"bottom-right"` etc. or `null`
|
|
17
|
+
* if unknown.
|
|
18
|
+
*
|
|
19
|
+
* @readonly
|
|
20
|
+
* @observable
|
|
21
|
+
*/
|
|
22
|
+
activeHandlePosition: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* The width (percents) proposed, but not committed yet, in the current resize process.
|
|
25
|
+
*
|
|
26
|
+
* @readonly
|
|
27
|
+
* @observable
|
|
28
|
+
*/
|
|
29
|
+
proposedWidthPercents: number | null;
|
|
30
|
+
/**
|
|
31
|
+
* The width (pixels) proposed, but not committed yet, in the current resize process.
|
|
32
|
+
*
|
|
33
|
+
* @readonly
|
|
34
|
+
* @observable
|
|
35
|
+
*/
|
|
36
|
+
proposedWidth: number | null;
|
|
37
|
+
/**
|
|
38
|
+
* The height (pixels) proposed, but not committed yet, in the current resize process.
|
|
39
|
+
*
|
|
40
|
+
* @readonly
|
|
41
|
+
* @observable
|
|
42
|
+
*/
|
|
43
|
+
proposedHeight: number | null;
|
|
44
|
+
/**
|
|
45
|
+
* @readonly
|
|
46
|
+
* @observable
|
|
47
|
+
*/
|
|
48
|
+
proposedHandleHostWidth: number | null;
|
|
49
|
+
/**
|
|
50
|
+
* @readonly
|
|
51
|
+
* @observable
|
|
52
|
+
*/
|
|
53
|
+
proposedHandleHostHeight: number | null;
|
|
54
|
+
/**
|
|
55
|
+
* The reference point of the resizer where the dragging started. It is used to measure the distance the user cursor
|
|
56
|
+
* traveled, so how much the image should be enlarged.
|
|
57
|
+
* This information is only known after the DOM was rendered, so it will be updated later.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
_referenceCoordinates: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
} | null;
|
|
65
|
+
/**
|
|
66
|
+
* Resizer options.
|
|
67
|
+
*/
|
|
68
|
+
private readonly _options;
|
|
69
|
+
/**
|
|
70
|
+
* The original width (pixels) of the resized object when the resize process was started.
|
|
71
|
+
*
|
|
72
|
+
* @readonly
|
|
73
|
+
*/
|
|
74
|
+
private _originalWidth?;
|
|
75
|
+
/**
|
|
76
|
+
* The original height (pixels) of the resized object when the resize process was started.
|
|
77
|
+
*
|
|
78
|
+
* @readonly
|
|
79
|
+
*/
|
|
80
|
+
private _originalHeight?;
|
|
81
|
+
/**
|
|
82
|
+
* The original width (percents) of the resized object when the resize process was started.
|
|
83
|
+
*
|
|
84
|
+
* @readonly
|
|
85
|
+
*/
|
|
86
|
+
private _originalWidthPercents?;
|
|
87
|
+
/**
|
|
88
|
+
* A width to height ratio of the resized image.
|
|
89
|
+
*
|
|
90
|
+
* @readonly
|
|
91
|
+
*/
|
|
92
|
+
private _aspectRatio?;
|
|
93
|
+
/**
|
|
94
|
+
* @param options Resizer options.
|
|
95
|
+
*/
|
|
96
|
+
constructor(options: WidgetResizerOptions);
|
|
97
|
+
/**
|
|
98
|
+
* The original width (pixels) of the resized object when the resize process was started.
|
|
99
|
+
*/
|
|
100
|
+
get originalWidth(): number | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* The original height (pixels) of the resized object when the resize process was started.
|
|
103
|
+
*/
|
|
104
|
+
get originalHeight(): number | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* The original width (percents) of the resized object when the resize process was started.
|
|
107
|
+
*/
|
|
108
|
+
get originalWidthPercents(): number | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* A width to height ratio of the resized image.
|
|
111
|
+
*/
|
|
112
|
+
get aspectRatio(): number | undefined;
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* @param domResizeHandle The handle used to calculate the reference point.
|
|
116
|
+
*/
|
|
117
|
+
begin(domResizeHandle: HTMLElement, domHandleHost: HTMLElement, domResizeHost: HTMLElement): void;
|
|
118
|
+
update(newSize: {
|
|
119
|
+
width: number;
|
|
120
|
+
height: number;
|
|
121
|
+
widthPercents: number;
|
|
122
|
+
handleHostWidth: number;
|
|
123
|
+
handleHostHeight: number;
|
|
124
|
+
}): void;
|
|
124
125
|
}
|
|
125
126
|
export {};
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { View } from
|
|
9
|
-
import type { WidgetResizerOptions } from
|
|
10
|
-
import { type WidgetResizeState } from
|
|
6
|
+
* @module widget/widgetresize/sizeview
|
|
7
|
+
*/
|
|
8
|
+
import { View } from "@ckeditor/ckeditor5-ui";
|
|
9
|
+
import type { WidgetResizerOptions } from "../widgetresize.js";
|
|
10
|
+
import { type WidgetResizeState } from "./resizerstate.js";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
* A view displaying the proposed new element size during the resizing.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
16
|
export declare class SizeView extends View {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The visibility of the view defined based on the existence of the host proposed dimensions.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
* @observable
|
|
22
|
+
* @readonly
|
|
23
|
+
*/
|
|
24
|
+
_isVisible: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The text that will be displayed in the `SizeView` child.
|
|
27
|
+
* It can be formatted as the pixel values (e.g. 10x20) or the percentage value (e.g. 10%).
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
* @observable
|
|
31
|
+
* @readonly
|
|
32
|
+
*/
|
|
33
|
+
_label: string;
|
|
34
|
+
/**
|
|
35
|
+
* The position of the view defined based on the host size and active handle position.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
* @observable
|
|
39
|
+
* @readonly
|
|
40
|
+
*/
|
|
41
|
+
_viewPosition: string;
|
|
42
|
+
constructor();
|
|
43
|
+
/**
|
|
44
|
+
* A method used for binding the `SizeView` instance properties to the `ResizeState` instance observable properties.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
* @param options An object defining the resizer options, used for setting the proper size label.
|
|
48
|
+
* @param resizeState The `ResizeState` class instance, used for keeping the `SizeView` state up to date.
|
|
49
|
+
*/
|
|
50
|
+
_bindToState(options: WidgetResizerOptions, resizeState: WidgetResizeState): void;
|
|
51
|
+
/**
|
|
52
|
+
* A method used for cleaning up. It removes the bindings and hides the view.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
_dismiss(): void;
|
|
57
57
|
}
|
package/dist/widgetresize.d.ts
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { WidgetResizer } from
|
|
9
|
-
import { Plugin, type Editor } from
|
|
10
|
-
import { type ModelElement, type ViewContainerElement } from
|
|
11
|
-
import
|
|
6
|
+
* @module widget/widgetresize
|
|
7
|
+
*/
|
|
8
|
+
import { WidgetResizer } from "./widgetresize/resizer.js";
|
|
9
|
+
import { Plugin, type Editor } from "@ckeditor/ckeditor5-core";
|
|
10
|
+
import { type ModelElement, type ViewContainerElement } from "@ckeditor/ckeditor5-engine";
|
|
11
|
+
import "../theme/widgetresize.css";
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
* The widget resize feature plugin.
|
|
14
|
+
*
|
|
15
|
+
* Use the {@link module:widget/widgetresize~WidgetResize#attachTo} method to create a resizer for the specified widget.
|
|
16
|
+
*/
|
|
17
17
|
export declare class WidgetResize extends Plugin {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The currently selected resizer.
|
|
20
|
+
*
|
|
21
|
+
* @observable
|
|
22
|
+
*/
|
|
23
|
+
selectedResizer: WidgetResizer | null;
|
|
24
|
+
/**
|
|
25
|
+
* References an active resizer.
|
|
26
|
+
*
|
|
27
|
+
* Active resizer means a resizer which handle is actively used by the end user.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
* @observable
|
|
31
|
+
*/
|
|
32
|
+
_activeResizer: WidgetResizer | null;
|
|
33
|
+
/**
|
|
34
|
+
* A map of resizers created using this plugin instance.
|
|
35
|
+
*/
|
|
36
|
+
private _resizers;
|
|
37
|
+
private _observer;
|
|
38
|
+
private _redrawSelectedResizerThrottled;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get pluginName(): "WidgetResize";
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
static override get isOfficialPlugin(): true;
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
init(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Redraws the selected resizer if there is any selected resizer and if it is visible.
|
|
53
|
+
*/
|
|
54
|
+
redrawSelectedResizer(): void;
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
override destroy(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Marks resizer as selected.
|
|
61
|
+
*/
|
|
62
|
+
select(resizer: WidgetResizer): void;
|
|
63
|
+
/**
|
|
64
|
+
* Deselects currently set resizer.
|
|
65
|
+
*/
|
|
66
|
+
deselect(): void;
|
|
67
|
+
/**
|
|
68
|
+
* @param options Resizer options.
|
|
69
|
+
*/
|
|
70
|
+
attachTo(options: WidgetResizerOptions): WidgetResizer;
|
|
71
|
+
/**
|
|
72
|
+
* Returns a resizer created for a given view element (widget element).
|
|
73
|
+
*
|
|
74
|
+
* @param viewElement View element associated with the resizer.
|
|
75
|
+
*/
|
|
76
|
+
getResizerByViewElement(viewElement: ViewContainerElement): WidgetResizer | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Returns a resizer that contains a given resize handle.
|
|
79
|
+
*/
|
|
80
|
+
private _getResizerByHandle;
|
|
81
|
+
/**
|
|
82
|
+
* @param domEventData Native DOM event.
|
|
83
|
+
*/
|
|
84
|
+
private _mouseDownListener;
|
|
85
|
+
/**
|
|
86
|
+
* @param domEventData Native DOM event.
|
|
87
|
+
*/
|
|
88
|
+
private _mouseMoveListener;
|
|
89
|
+
private _mouseUpListener;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
* Interface describing a resizer. It allows to specify the resizing host, custom logic for calculating aspect ratio, etc.
|
|
93
|
+
*/
|
|
94
94
|
export interface WidgetResizerOptions {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Editor instance associated with the resizer.
|
|
97
|
+
*/
|
|
98
|
+
editor: Editor;
|
|
99
|
+
modelElement: ModelElement;
|
|
100
|
+
/**
|
|
101
|
+
* A view of an element to be resized. Typically it's the main widget's view instance.
|
|
102
|
+
*/
|
|
103
|
+
viewElement: ViewContainerElement;
|
|
104
|
+
unit?: "px" | "%";
|
|
105
|
+
/**
|
|
106
|
+
* A callback to be executed once the resizing process is done.
|
|
107
|
+
*
|
|
108
|
+
* It receives a `Number` (`newValue`) as a parameter.
|
|
109
|
+
*
|
|
110
|
+
* For example, {@link module:image/imageresize~ImageResize} uses it to execute the resize image command
|
|
111
|
+
* which puts the new value into the model.
|
|
112
|
+
*
|
|
113
|
+
* ```ts
|
|
114
|
+
* {
|
|
115
|
+
* editor,
|
|
116
|
+
* modelElement: data.item,
|
|
117
|
+
* viewElement: widget,
|
|
118
|
+
*
|
|
119
|
+
* onCommit( newValue ) {
|
|
120
|
+
* editor.execute( 'resizeImage', { width: newValue } );
|
|
121
|
+
* }
|
|
122
|
+
* };
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
onCommit: (newValue: string) => void;
|
|
126
|
+
getResizeHost: (widgetWrapper: HTMLElement) => HTMLElement;
|
|
127
|
+
getHandleHost: (widgetWrapper: HTMLElement) => HTMLElement;
|
|
128
|
+
isCentered?: (resizer: WidgetResizer) => boolean;
|
|
129
129
|
}
|