@ckeditor/ckeditor5-widget 48.2.0-alpha.7 → 48.3.0-alpha.0
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
package/dist/widget.d.ts
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
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 { Plugin } from
|
|
9
|
-
import { type ModelElement, type ModelNode, type ViewPosition, type ModelRange } from
|
|
10
|
-
import { Delete } from
|
|
11
|
-
import { WidgetTypeAround } from
|
|
12
|
-
import
|
|
6
|
+
* @module widget/widget
|
|
7
|
+
*/
|
|
8
|
+
import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
|
|
9
|
+
import { type ModelElement, type ModelNode, type ViewPosition, type ModelRange } from "@ckeditor/ckeditor5-engine";
|
|
10
|
+
import { Delete } from "@ckeditor/ckeditor5-typing";
|
|
11
|
+
import { WidgetTypeAround } from "./widgettypearound/widgettypearound.js";
|
|
12
|
+
import "../theme/widget.css";
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
* The widget plugin. It enables base support for widgets.
|
|
15
|
+
*
|
|
16
|
+
* See {@glink api/widget package page} for more details and documentation.
|
|
17
|
+
*
|
|
18
|
+
* This plugin enables multiple behaviors required by widgets:
|
|
19
|
+
*
|
|
20
|
+
* * The model to view selection converter for the editing pipeline (it handles widget custom selection rendering).
|
|
21
|
+
* If a converted selection wraps around a widget element, that selection is marked as
|
|
22
|
+
* {@link module:engine/view/selection~ViewSelection#isFake fake}. Additionally, the `ck-widget_selected` CSS class
|
|
23
|
+
* is added to indicate that widget has been selected.
|
|
24
|
+
* * The mouse and keyboard events handling on and around widget elements.
|
|
25
|
+
*/
|
|
26
26
|
export declare class Widget extends Plugin {
|
|
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
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Holds previously selected widgets.
|
|
29
|
+
*/
|
|
30
|
+
private _previouslySelected;
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
34
|
+
static get pluginName(): "Widget";
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
38
|
+
static override get isOfficialPlugin(): true;
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
static get requires(): PluginDependenciesOf<[WidgetTypeAround, Delete]>;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
init(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:mousedown mousedown} events on widget elements.
|
|
49
|
+
*/
|
|
50
|
+
private _onMousedown;
|
|
51
|
+
/**
|
|
52
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:pointerdown pointerdown} events on widget elements.
|
|
53
|
+
*/
|
|
54
|
+
private _onPointerdown;
|
|
55
|
+
/**
|
|
56
|
+
* Selects entire block content, e.g. on triple click it selects entire paragraph.
|
|
57
|
+
*/
|
|
58
|
+
private _selectBlockContent;
|
|
59
|
+
/**
|
|
60
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and changes
|
|
61
|
+
* the model selection when:
|
|
62
|
+
*
|
|
63
|
+
* * arrow key is pressed when the widget is selected,
|
|
64
|
+
* * the selection is next to a widget and the widget should become selected upon the arrow key press.
|
|
65
|
+
*
|
|
66
|
+
* See {@link #_preventDefaultOnArrowKeyPress}.
|
|
67
|
+
*/
|
|
68
|
+
private _handleSelectionChangeOnArrowKeyPress;
|
|
69
|
+
/**
|
|
70
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and prevents
|
|
71
|
+
* the default browser behavior to make sure the fake selection is not being moved from a fake selection
|
|
72
|
+
* container.
|
|
73
|
+
*
|
|
74
|
+
* See {@link #_handleSelectionChangeOnArrowKeyPress}.
|
|
75
|
+
*/
|
|
76
|
+
private _preventDefaultOnArrowKeyPress;
|
|
77
|
+
/**
|
|
78
|
+
* Handles delete keys: backspace and delete.
|
|
79
|
+
*
|
|
80
|
+
* @param isForward Set to true if delete was performed in forward direction.
|
|
81
|
+
* @returns Returns `true` if keys were handled correctly.
|
|
82
|
+
*/
|
|
83
|
+
private _handleDelete;
|
|
84
|
+
/**
|
|
85
|
+
* Sets {@link module:engine/model/selection~ModelSelection document's selection} over given element.
|
|
86
|
+
*
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
_setSelectionOverElement(element: ModelNode): void;
|
|
90
|
+
/**
|
|
91
|
+
* Checks if {@link module:engine/model/element~ModelElement element} placed next to the current
|
|
92
|
+
* {@link module:engine/model/selection~ModelSelection model selection} exists and is marked in
|
|
93
|
+
* {@link module:engine/model/schema~ModelSchema schema} as `object`.
|
|
94
|
+
*
|
|
95
|
+
* @internal
|
|
96
|
+
* @param forward Direction of checking.
|
|
97
|
+
*/
|
|
98
|
+
_getObjectElementNextToSelection(forward: boolean): ModelElement | null;
|
|
99
|
+
/**
|
|
100
|
+
* Removes CSS class from previously selected widgets.
|
|
101
|
+
*/
|
|
102
|
+
private _clearPreviouslySelectedWidgets;
|
|
103
|
+
/**
|
|
104
|
+
* Moves the document selection into the next editable or block widget.
|
|
105
|
+
*/
|
|
106
|
+
private _selectNextEditable;
|
|
107
|
+
/**
|
|
108
|
+
* Looks for next focus point in the document starting from the given view position and direction.
|
|
109
|
+
* The focus point is either a block widget or an editable.
|
|
110
|
+
*
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
_findNextFocusRange(startPosition: ViewPosition, direction: "backward" | "forward"): ModelRange | null;
|
|
114
|
+
/**
|
|
115
|
+
* Updates the document selection so that it selects first ancestor widget.
|
|
116
|
+
*/
|
|
117
|
+
private _selectAncestorWidget;
|
|
118
118
|
}
|
|
@@ -1,177 +1,174 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { Rect, type DecoratedMethodEvent } from
|
|
6
|
-
import { WidgetResizeState } from
|
|
7
|
-
import type { WidgetResizerOptions } from
|
|
8
|
-
declare const
|
|
9
|
-
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
|
10
|
-
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
|
11
|
-
};
|
|
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
|
+
import { Rect, type DecoratedMethodEvent, type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
|
|
6
|
+
import { WidgetResizeState } from "./resizerstate.js";
|
|
7
|
+
import type { WidgetResizerOptions } from "../widgetresize.js";
|
|
8
|
+
declare const WidgetResizerBase: ObservableMixinConstructor;
|
|
12
9
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare class WidgetResizer extends
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
10
|
+
* Represents a resizer for a single resizable object.
|
|
11
|
+
*/
|
|
12
|
+
export declare class WidgetResizer extends WidgetResizerBase {
|
|
13
|
+
/**
|
|
14
|
+
* Flag that indicates whether resizer can be used.
|
|
15
|
+
*
|
|
16
|
+
* @observable
|
|
17
|
+
*/
|
|
18
|
+
isEnabled: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Flag that indicates that resizer is currently focused.
|
|
21
|
+
*
|
|
22
|
+
* @observable
|
|
23
|
+
*/
|
|
24
|
+
isSelected: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Flag that indicates whether resizer is rendered (visible on the screen).
|
|
27
|
+
*
|
|
28
|
+
* @readonly
|
|
29
|
+
* @observable
|
|
30
|
+
*/
|
|
31
|
+
isVisible: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.
|
|
34
|
+
*
|
|
35
|
+
* Note that a new state is created for each resize transaction.
|
|
36
|
+
*/
|
|
37
|
+
private _state;
|
|
38
|
+
/**
|
|
39
|
+
* A view displaying the proposed new element size during the resizing.
|
|
40
|
+
*/
|
|
41
|
+
private _sizeView;
|
|
42
|
+
/**
|
|
43
|
+
* Options passed to the {@link #constructor}.
|
|
44
|
+
*/
|
|
45
|
+
private _options;
|
|
46
|
+
/**
|
|
47
|
+
* A wrapper that is controlled by the resizer. This is usually a widget element.
|
|
48
|
+
*/
|
|
49
|
+
private _viewResizerWrapper;
|
|
50
|
+
/**
|
|
51
|
+
* The width of the resized {@link module:widget/widgetresize~WidgetResizerOptions#viewElement viewElement} before the resizing started.
|
|
52
|
+
*/
|
|
53
|
+
private _initialViewWidth;
|
|
54
|
+
/**
|
|
55
|
+
* @param options Resizer options.
|
|
56
|
+
*/
|
|
57
|
+
constructor(options: WidgetResizerOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.
|
|
60
|
+
*
|
|
61
|
+
* Note that a new state is created for each resize transaction.
|
|
62
|
+
*/
|
|
63
|
+
get state(): WidgetResizeState;
|
|
64
|
+
/**
|
|
65
|
+
* Makes resizer visible in the UI.
|
|
66
|
+
*/
|
|
67
|
+
show(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Hides resizer in the UI.
|
|
70
|
+
*/
|
|
71
|
+
hide(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Attaches the resizer to the DOM.
|
|
74
|
+
*/
|
|
75
|
+
attach(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Starts the resizing process.
|
|
78
|
+
*
|
|
79
|
+
* Creates a new {@link #state} for the current process.
|
|
80
|
+
*
|
|
81
|
+
* @fires begin
|
|
82
|
+
* @param domResizeHandle Clicked handle.
|
|
83
|
+
*/
|
|
84
|
+
begin(domResizeHandle: HTMLElement): void;
|
|
85
|
+
/**
|
|
86
|
+
* Updates the proposed size based on `domEventData`.
|
|
87
|
+
*
|
|
88
|
+
* @fires updateSize
|
|
89
|
+
*/
|
|
90
|
+
updateSize(domEventData: MouseEvent): void;
|
|
91
|
+
/**
|
|
92
|
+
* Applies the geometry proposed with the resizer.
|
|
93
|
+
*
|
|
94
|
+
* @fires commit
|
|
95
|
+
*/
|
|
96
|
+
commit(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Cancels and rejects the proposed resize dimensions, hiding the UI.
|
|
99
|
+
*
|
|
100
|
+
* @fires cancel
|
|
101
|
+
*/
|
|
102
|
+
cancel(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Destroys the resizer.
|
|
105
|
+
*/
|
|
106
|
+
destroy(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Redraws the resizer.
|
|
109
|
+
*
|
|
110
|
+
* @param handleHostRect Handle host rectangle might be given to improve performance.
|
|
111
|
+
*/
|
|
112
|
+
redraw(handleHostRect?: Rect): void;
|
|
113
|
+
containsHandle(domElement: HTMLElement): boolean;
|
|
114
|
+
static isResizeHandle(domElement: HTMLElement): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Cleans up the context state.
|
|
117
|
+
*/
|
|
118
|
+
private _cleanup;
|
|
119
|
+
/**
|
|
120
|
+
* Calculates the proposed size as the resize handles are dragged.
|
|
121
|
+
*
|
|
122
|
+
* @param domEventData Event data that caused the size update request. It should be used to calculate the proposed size.
|
|
123
|
+
*/
|
|
124
|
+
private _proposeNewSize;
|
|
125
|
+
/**
|
|
126
|
+
* Obtains the resize host.
|
|
127
|
+
*
|
|
128
|
+
* Resize host is an object that receives dimensions which are the result of resizing.
|
|
129
|
+
*/
|
|
130
|
+
private _getResizeHost;
|
|
131
|
+
/**
|
|
132
|
+
* Obtains the handle host.
|
|
133
|
+
*
|
|
134
|
+
* Handle host is an object that the handles are aligned to.
|
|
135
|
+
*
|
|
136
|
+
* Handle host will not always be an entire widget itself. Take an image as an example. The image widget
|
|
137
|
+
* contains an image and a caption. Only the image should be surrounded with handles.
|
|
138
|
+
*/
|
|
139
|
+
private _getHandleHost;
|
|
140
|
+
/**
|
|
141
|
+
* DOM container of the entire resize UI.
|
|
142
|
+
*
|
|
143
|
+
* Note that this property will have a value only after the element bound with the resizer is rendered
|
|
144
|
+
* (otherwise `null`).
|
|
145
|
+
*/
|
|
146
|
+
private get _domResizerWrapper();
|
|
147
|
+
/**
|
|
148
|
+
* Renders the resize handles in the DOM.
|
|
149
|
+
*
|
|
150
|
+
* @param domElement The resizer wrapper.
|
|
151
|
+
*/
|
|
152
|
+
private _appendHandles;
|
|
153
|
+
/**
|
|
154
|
+
* Sets up the {@link #_sizeView} property and adds it to the passed `domElement`.
|
|
155
|
+
*/
|
|
156
|
+
private _appendSizeUI;
|
|
160
157
|
}
|
|
161
158
|
/**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
export type WidgetResizerBeginEvent = DecoratedMethodEvent<WidgetResizer,
|
|
159
|
+
* @eventName ~WidgetResizer#begin
|
|
160
|
+
*/
|
|
161
|
+
export type WidgetResizerBeginEvent = DecoratedMethodEvent<WidgetResizer, "begin">;
|
|
165
162
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
export type WidgetResizerCancelEvent = DecoratedMethodEvent<WidgetResizer,
|
|
163
|
+
* @eventName ~WidgetResizer#cancel
|
|
164
|
+
*/
|
|
165
|
+
export type WidgetResizerCancelEvent = DecoratedMethodEvent<WidgetResizer, "cancel">;
|
|
169
166
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
export type WidgetResizerCommitEvent = DecoratedMethodEvent<WidgetResizer,
|
|
167
|
+
* @eventName ~WidgetResizer#commit
|
|
168
|
+
*/
|
|
169
|
+
export type WidgetResizerCommitEvent = DecoratedMethodEvent<WidgetResizer, "commit">;
|
|
173
170
|
/**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
export type WidgetResizerUpdateSizeEvent = DecoratedMethodEvent<WidgetResizer,
|
|
171
|
+
* @eventName ~WidgetResizer#updateSize
|
|
172
|
+
*/
|
|
173
|
+
export type WidgetResizerUpdateSizeEvent = DecoratedMethodEvent<WidgetResizer, "updateSize">;
|
|
177
174
|
export {};
|