@ckeditor/ckeditor5-widget 0.0.0-nightly-20250616.0 → 0.0.0-nightly-20250618.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.
Potentially problematic release.
This version of @ckeditor/ckeditor5-widget might be problematic. Click here for more details.
- package/dist/index.js +20 -19
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/highlightstack.d.ts +7 -7
- package/src/highlightstack.js +2 -2
- package/src/utils.d.ts +11 -10
- package/src/utils.js +7 -6
- package/src/widget.d.ts +11 -11
- package/src/widget.js +10 -10
- package/src/widgetresize.d.ts +2 -2
- package/src/widgettypearound/utils.d.ts +4 -4
- package/src/widgettypearound/widgettypearound.d.ts +1 -1
- package/src/widgettypearound/widgettypearound.js +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-widget",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20250618.0",
|
4
4
|
"description": "Widget API for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,13 +12,13 @@
|
|
12
12
|
"type": "module",
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"@ckeditor/ckeditor5-core": "0.0.0-nightly-
|
16
|
-
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-
|
17
|
-
"@ckeditor/ckeditor5-enter": "0.0.0-nightly-
|
18
|
-
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-
|
19
|
-
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-
|
20
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-
|
21
|
-
"@ckeditor/ckeditor5-typing": "0.0.0-nightly-
|
15
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20250618.0",
|
16
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250618.0",
|
17
|
+
"@ckeditor/ckeditor5-enter": "0.0.0-nightly-20250618.0",
|
18
|
+
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-20250618.0",
|
19
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250618.0",
|
20
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250618.0",
|
21
|
+
"@ckeditor/ckeditor5-typing": "0.0.0-nightly-20250618.0",
|
22
22
|
"es-toolkit": "1.38.0"
|
23
23
|
},
|
24
24
|
"author": "CKSource (http://cksource.com/)",
|
package/src/highlightstack.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
4
4
|
*/
|
5
|
-
import type {
|
5
|
+
import type { ViewDowncastWriter, DowncastHighlightDescriptor } from '@ckeditor/ckeditor5-engine';
|
6
6
|
declare const WidgetHighlightStack_base: {
|
7
7
|
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
8
8
|
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
@@ -14,7 +14,7 @@ declare const WidgetHighlightStack_base: {
|
|
14
14
|
*
|
15
15
|
* * highlight with highest priority should be applied,
|
16
16
|
* * if two highlights have same priority - sort by CSS class provided in
|
17
|
-
* {@link module:engine/conversion/downcasthelpers~
|
17
|
+
* {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor}.
|
18
18
|
*
|
19
19
|
* This way, highlight will be applied with the same rules it is applied on texts.
|
20
20
|
*/
|
@@ -25,14 +25,14 @@ export declare class WidgetHighlightStack extends /* #__PURE__ */ WidgetHighligh
|
|
25
25
|
*
|
26
26
|
* @fires change:top
|
27
27
|
*/
|
28
|
-
add(descriptor:
|
28
|
+
add(descriptor: DowncastHighlightDescriptor, writer: ViewDowncastWriter): void;
|
29
29
|
/**
|
30
30
|
* Removes highlight descriptor from the stack.
|
31
31
|
*
|
32
32
|
* @fires change:top
|
33
33
|
* @param id Id of the descriptor to remove.
|
34
34
|
*/
|
35
|
-
remove(id: string, writer:
|
35
|
+
remove(id: string, writer: ViewDowncastWriter): void;
|
36
36
|
/**
|
37
37
|
* Inserts a given descriptor in correct place in the stack. It also takes care about updating information
|
38
38
|
* when descriptor with same id is already present.
|
@@ -61,14 +61,14 @@ export type WidgetHighlightStackChangeEventData = {
|
|
61
61
|
/**
|
62
62
|
* Old highlight descriptor. It will be `undefined` when first descriptor is added to the stack.
|
63
63
|
*/
|
64
|
-
oldDescriptor:
|
64
|
+
oldDescriptor: DowncastHighlightDescriptor;
|
65
65
|
/**
|
66
66
|
* New highlight descriptor. It will be `undefined` when last descriptor is removed from the stack.
|
67
67
|
*/
|
68
|
-
newDescriptor:
|
68
|
+
newDescriptor: DowncastHighlightDescriptor;
|
69
69
|
/**
|
70
70
|
* View writer that can be used to modify element.
|
71
71
|
*/
|
72
|
-
writer:
|
72
|
+
writer: ViewDowncastWriter;
|
73
73
|
};
|
74
74
|
export {};
|
package/src/highlightstack.js
CHANGED
@@ -13,7 +13,7 @@ import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
13
13
|
*
|
14
14
|
* * highlight with highest priority should be applied,
|
15
15
|
* * if two highlights have same priority - sort by CSS class provided in
|
16
|
-
* {@link module:engine/conversion/downcasthelpers~
|
16
|
+
* {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor}.
|
17
17
|
*
|
18
18
|
* This way, highlight will be applied with the same rules it is applied on texts.
|
19
19
|
*/
|
@@ -118,7 +118,7 @@ function shouldABeBeforeB(a, b) {
|
|
118
118
|
return classesToString(a.classes) > classesToString(b.classes);
|
119
119
|
}
|
120
120
|
/**
|
121
|
-
* Converts CSS classes passed with {@link module:engine/conversion/downcasthelpers~
|
121
|
+
* Converts CSS classes passed with {@link module:engine/conversion/downcasthelpers~DowncastHighlightDescriptor} to
|
122
122
|
* sorted string.
|
123
123
|
*/
|
124
124
|
function classesToString(classes) {
|
package/src/utils.d.ts
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
4
4
|
*/
|
5
5
|
import { Rect, type GetCallback } from '@ckeditor/ckeditor5-utils';
|
6
|
-
import { type
|
6
|
+
import { type DowncastHighlightDescriptor, type MapperViewToModelPositionEvent, type ModelDocumentSelection, type ViewDowncastWriter, type Model, type ModelRange, type ModelSelection, type ViewEditableElement, type ViewElement, type ViewTypeCheckable } from '@ckeditor/ckeditor5-engine';
|
7
7
|
/**
|
8
8
|
* CSS class added to each widget element.
|
9
9
|
*/
|
@@ -13,15 +13,15 @@ export declare const WIDGET_CLASS_NAME = "ck-widget";
|
|
13
13
|
*/
|
14
14
|
export declare const WIDGET_SELECTED_CLASS_NAME = "ck-widget_selected";
|
15
15
|
/**
|
16
|
-
* Returns `true` if given {@link module:engine/view/node~
|
16
|
+
* Returns `true` if given {@link module:engine/view/node~ViewNode} is an {@link module:engine/view/element~ViewElement} and a widget.
|
17
17
|
*/
|
18
18
|
export declare function isWidget(node: ViewTypeCheckable): boolean;
|
19
19
|
/**
|
20
|
-
* Converts the given {@link module:engine/view/element~
|
20
|
+
* Converts the given {@link module:engine/view/element~ViewElement} to a widget in the following way:
|
21
21
|
*
|
22
22
|
* * sets the `contenteditable` attribute to `"false"`,
|
23
23
|
* * adds the `ck-widget` CSS class,
|
24
|
-
* * adds a custom {@link module:engine/view/element~
|
24
|
+
* * adds a custom {@link module:engine/view/element~ViewElement#getFillerOffset `getFillerOffset()`} method returning `null`,
|
25
25
|
* * adds a custom property allowing to recognize widget elements by using {@link ~isWidget `isWidget()`},
|
26
26
|
* * implements the {@link ~setHighlightHandling view highlight on widgets}.
|
27
27
|
*
|
@@ -62,7 +62,7 @@ export declare function isWidget(node: ViewTypeCheckable): boolean;
|
|
62
62
|
* @param options.hasSelectionHandle If `true`, the widget will have a selection handle added.
|
63
63
|
* @returns Returns the same element.
|
64
64
|
*/
|
65
|
-
export declare function toWidget(element: ViewElement, writer:
|
65
|
+
export declare function toWidget(element: ViewElement, writer: ViewDowncastWriter, options?: {
|
66
66
|
label?: string | (() => string);
|
67
67
|
hasSelectionHandle?: boolean;
|
68
68
|
}): ViewElement;
|
@@ -70,7 +70,7 @@ export declare function toWidget(element: ViewElement, writer: DowncastWriter, o
|
|
70
70
|
* Sets highlight handling methods. Uses {@link module:widget/highlightstack~WidgetHighlightStack} to
|
71
71
|
* properly determine which highlight descriptor should be used at given time.
|
72
72
|
*/
|
73
|
-
export declare function setHighlightHandling(element: ViewElement, writer:
|
73
|
+
export declare function setHighlightHandling(element: ViewElement, writer: ViewDowncastWriter, add?: (element: ViewElement, descriptor: DowncastHighlightDescriptor, writer: ViewDowncastWriter) => void, remove?: (element: ViewElement, descriptor: DowncastHighlightDescriptor, writer: ViewDowncastWriter) => void): void;
|
74
74
|
/**
|
75
75
|
* Sets label for given element.
|
76
76
|
* It can be passed as a plain string or a function returning a string. Function will be called each time label is retrieved by
|
@@ -82,9 +82,10 @@ export declare function setLabel(element: ViewElement, labelOrCreator: string |
|
|
82
82
|
*/
|
83
83
|
export declare function getLabel(element: ViewElement): string;
|
84
84
|
/**
|
85
|
-
* Adds functionality to the provided {@link module:engine/view/editableelement~
|
85
|
+
* Adds functionality to the provided {@link module:engine/view/editableelement~ViewEditableElement} to act as a widget's editable:
|
86
86
|
*
|
87
|
-
* * sets the `contenteditable` attribute to `true` when
|
87
|
+
* * sets the `contenteditable` attribute to `true` when
|
88
|
+
* {@link module:engine/view/editableelement~ViewEditableElement#isReadOnly} is `false`,
|
88
89
|
* otherwise sets it to `false`,
|
89
90
|
* * adds the `ck-editor__editable` and `ck-editor__nested-editable` CSS classes,
|
90
91
|
* * adds the `ck-editor__nested-editable_focused` CSS class when the editable is focused and removes it when it is blurred.
|
@@ -125,7 +126,7 @@ export declare function getLabel(element: ViewElement): string;
|
|
125
126
|
* @param options.withAriaRole Whether to add the role="textbox" attribute on the editable. Defaults to `true`.
|
126
127
|
* @returns Returns the same element that was provided in the `editable` parameter
|
127
128
|
*/
|
128
|
-
export declare function toWidgetEditable(editable: ViewEditableElement, writer:
|
129
|
+
export declare function toWidgetEditable(editable: ViewEditableElement, writer: ViewDowncastWriter, options?: {
|
129
130
|
label?: string;
|
130
131
|
withAriaRole?: boolean;
|
131
132
|
}): ViewEditableElement;
|
@@ -144,7 +145,7 @@ export declare function toWidgetEditable(editable: ViewEditableElement, writer:
|
|
144
145
|
* @param model Model instance.
|
145
146
|
* @returns The optimal range.
|
146
147
|
*/
|
147
|
-
export declare function findOptimalInsertionRange(selection:
|
148
|
+
export declare function findOptimalInsertionRange(selection: ModelSelection | ModelDocumentSelection, model: Model): ModelRange;
|
148
149
|
/**
|
149
150
|
* A util to be used in order to map view positions to correct model positions when implementing a widget
|
150
151
|
* which renders non-empty view element for an empty model element.
|
package/src/utils.js
CHANGED
@@ -19,7 +19,7 @@ export const WIDGET_CLASS_NAME = 'ck-widget';
|
|
19
19
|
*/
|
20
20
|
export const WIDGET_SELECTED_CLASS_NAME = 'ck-widget_selected';
|
21
21
|
/**
|
22
|
-
* Returns `true` if given {@link module:engine/view/node~
|
22
|
+
* Returns `true` if given {@link module:engine/view/node~ViewNode} is an {@link module:engine/view/element~ViewElement} and a widget.
|
23
23
|
*/
|
24
24
|
export function isWidget(node) {
|
25
25
|
if (!node.is('element')) {
|
@@ -28,11 +28,11 @@ export function isWidget(node) {
|
|
28
28
|
return !!node.getCustomProperty('widget');
|
29
29
|
}
|
30
30
|
/**
|
31
|
-
* Converts the given {@link module:engine/view/element~
|
31
|
+
* Converts the given {@link module:engine/view/element~ViewElement} to a widget in the following way:
|
32
32
|
*
|
33
33
|
* * sets the `contenteditable` attribute to `"false"`,
|
34
34
|
* * adds the `ck-widget` CSS class,
|
35
|
-
* * adds a custom {@link module:engine/view/element~
|
35
|
+
* * adds a custom {@link module:engine/view/element~ViewElement#getFillerOffset `getFillerOffset()`} method returning `null`,
|
36
36
|
* * adds a custom property allowing to recognize widget elements by using {@link ~isWidget `isWidget()`},
|
37
37
|
* * implements the {@link ~setHighlightHandling view highlight on widgets}.
|
38
38
|
*
|
@@ -76,7 +76,7 @@ export function isWidget(node) {
|
|
76
76
|
export function toWidget(element, writer, options = {}) {
|
77
77
|
if (!element.is('containerElement')) {
|
78
78
|
/**
|
79
|
-
* The element passed to `toWidget()` must be a {@link module:engine/view/containerelement~
|
79
|
+
* The element passed to `toWidget()` must be a {@link module:engine/view/containerelement~ViewContainerElement}
|
80
80
|
* instance.
|
81
81
|
*
|
82
82
|
* @error widget-to-widget-wrong-element-type
|
@@ -169,9 +169,10 @@ export function getLabel(element) {
|
|
169
169
|
}, '');
|
170
170
|
}
|
171
171
|
/**
|
172
|
-
* Adds functionality to the provided {@link module:engine/view/editableelement~
|
172
|
+
* Adds functionality to the provided {@link module:engine/view/editableelement~ViewEditableElement} to act as a widget's editable:
|
173
173
|
*
|
174
|
-
* * sets the `contenteditable` attribute to `true` when
|
174
|
+
* * sets the `contenteditable` attribute to `true` when
|
175
|
+
* {@link module:engine/view/editableelement~ViewEditableElement#isReadOnly} is `false`,
|
175
176
|
* otherwise sets it to `false`,
|
176
177
|
* * adds the `ck-editor__editable` and `ck-editor__nested-editable` CSS classes,
|
177
178
|
* * adds the `ck-editor__nested-editable_focused` CSS class when the editable is focused and removes it when it is blurred.
|
package/src/widget.d.ts
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* @module widget/widget
|
7
7
|
*/
|
8
8
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
9
|
-
import { type
|
9
|
+
import { type ModelElement, type ModelNode } from '@ckeditor/ckeditor5-engine';
|
10
10
|
import { Delete } from '@ckeditor/ckeditor5-typing';
|
11
11
|
import { WidgetTypeAround } from './widgettypearound/widgettypearound.js';
|
12
12
|
import '../theme/widget.css';
|
@@ -19,7 +19,7 @@ import '../theme/widget.css';
|
|
19
19
|
*
|
20
20
|
* * The model to view selection converter for the editing pipeline (it handles widget custom selection rendering).
|
21
21
|
* If a converted selection wraps around a widget element, that selection is marked as
|
22
|
-
* {@link module:engine/view/selection~
|
22
|
+
* {@link module:engine/view/selection~ViewSelection#isFake fake}. Additionally, the `ck-widget_selected` CSS class
|
23
23
|
* is added to indicate that widget has been selected.
|
24
24
|
* * The mouse and keyboard events handling on and around widget elements.
|
25
25
|
*/
|
@@ -45,7 +45,7 @@ export declare class Widget extends Plugin {
|
|
45
45
|
*/
|
46
46
|
init(): void;
|
47
47
|
/**
|
48
|
-
* Handles {@link module:engine/view/document~
|
48
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:mousedown mousedown} events on widget elements.
|
49
49
|
*/
|
50
50
|
private _onMousedown;
|
51
51
|
/**
|
@@ -53,7 +53,7 @@ export declare class Widget extends Plugin {
|
|
53
53
|
*/
|
54
54
|
private _selectBlockContent;
|
55
55
|
/**
|
56
|
-
* Handles {@link module:engine/view/document~
|
56
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and changes
|
57
57
|
* the model selection when:
|
58
58
|
*
|
59
59
|
* * arrow key is pressed when the widget is selected,
|
@@ -63,7 +63,7 @@ export declare class Widget extends Plugin {
|
|
63
63
|
*/
|
64
64
|
private _handleSelectionChangeOnArrowKeyPress;
|
65
65
|
/**
|
66
|
-
* Handles {@link module:engine/view/document~
|
66
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and prevents
|
67
67
|
* the default browser behavior to make sure the fake selection is not being moved from a fake selection
|
68
68
|
* container.
|
69
69
|
*
|
@@ -78,20 +78,20 @@ export declare class Widget extends Plugin {
|
|
78
78
|
*/
|
79
79
|
private _handleDelete;
|
80
80
|
/**
|
81
|
-
* Sets {@link module:engine/model/selection~
|
81
|
+
* Sets {@link module:engine/model/selection~ModelSelection document's selection} over given element.
|
82
82
|
*
|
83
83
|
* @internal
|
84
84
|
*/
|
85
|
-
_setSelectionOverElement(element:
|
85
|
+
_setSelectionOverElement(element: ModelNode): void;
|
86
86
|
/**
|
87
|
-
* Checks if {@link module:engine/model/element~
|
88
|
-
* {@link module:engine/model/selection~
|
89
|
-
* {@link module:engine/model/schema~
|
87
|
+
* Checks if {@link module:engine/model/element~ModelElement element} placed next to the current
|
88
|
+
* {@link module:engine/model/selection~ModelSelection model selection} exists and is marked in
|
89
|
+
* {@link module:engine/model/schema~ModelSchema schema} as `object`.
|
90
90
|
*
|
91
91
|
* @internal
|
92
92
|
* @param forward Direction of checking.
|
93
93
|
*/
|
94
|
-
_getObjectElementNextToSelection(forward: boolean):
|
94
|
+
_getObjectElementNextToSelection(forward: boolean): ModelElement | null;
|
95
95
|
/**
|
96
96
|
* Removes CSS class from previously selected widgets.
|
97
97
|
*/
|
package/src/widget.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* @module widget/widget
|
7
7
|
*/
|
8
8
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
9
|
-
import { MouseObserver,
|
9
|
+
import { MouseObserver, ModelTreeWalker } from '@ckeditor/ckeditor5-engine';
|
10
10
|
import { Delete } from '@ckeditor/ckeditor5-typing';
|
11
11
|
import { env, keyCodes, getLocalizedArrowKeyCodeDirection, getRangeFromMouseEvent } from '@ckeditor/ckeditor5-utils';
|
12
12
|
import { WidgetTypeAround } from './widgettypearound/widgettypearound.js';
|
@@ -22,7 +22,7 @@ import '../theme/widget.css';
|
|
22
22
|
*
|
23
23
|
* * The model to view selection converter for the editing pipeline (it handles widget custom selection rendering).
|
24
24
|
* If a converted selection wraps around a widget element, that selection is marked as
|
25
|
-
* {@link module:engine/view/selection~
|
25
|
+
* {@link module:engine/view/selection~ViewSelection#isFake fake}. Additionally, the `ck-widget_selected` CSS class
|
26
26
|
* is added to indicate that widget has been selected.
|
27
27
|
* * The mouse and keyboard events handling on and around widget elements.
|
28
28
|
*/
|
@@ -213,7 +213,7 @@ export class Widget extends Plugin {
|
|
213
213
|
});
|
214
214
|
}
|
215
215
|
/**
|
216
|
-
* Handles {@link module:engine/view/document~
|
216
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:mousedown mousedown} events on widget elements.
|
217
217
|
*/
|
218
218
|
_onMousedown(eventInfo, domEventData) {
|
219
219
|
const editor = this.editor;
|
@@ -290,7 +290,7 @@ export class Widget extends Plugin {
|
|
290
290
|
return true;
|
291
291
|
}
|
292
292
|
/**
|
293
|
-
* Handles {@link module:engine/view/document~
|
293
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and changes
|
294
294
|
* the model selection when:
|
295
295
|
*
|
296
296
|
* * arrow key is pressed when the widget is selected,
|
@@ -353,7 +353,7 @@ export class Widget extends Plugin {
|
|
353
353
|
}
|
354
354
|
}
|
355
355
|
/**
|
356
|
-
* Handles {@link module:engine/view/document~
|
356
|
+
* Handles {@link module:engine/view/document~ViewDocument#event:keydown keydown} events and prevents
|
357
357
|
* the default browser behavior to make sure the fake selection is not being moved from a fake selection
|
358
358
|
* container.
|
359
359
|
*
|
@@ -402,7 +402,7 @@ export class Widget extends Plugin {
|
|
402
402
|
}
|
403
403
|
}
|
404
404
|
/**
|
405
|
-
* Sets {@link module:engine/model/selection~
|
405
|
+
* Sets {@link module:engine/model/selection~ModelSelection document's selection} over given element.
|
406
406
|
*
|
407
407
|
* @internal
|
408
408
|
*/
|
@@ -412,9 +412,9 @@ export class Widget extends Plugin {
|
|
412
412
|
});
|
413
413
|
}
|
414
414
|
/**
|
415
|
-
* Checks if {@link module:engine/model/element~
|
416
|
-
* {@link module:engine/model/selection~
|
417
|
-
* {@link module:engine/model/schema~
|
415
|
+
* Checks if {@link module:engine/model/element~ModelElement element} placed next to the current
|
416
|
+
* {@link module:engine/model/selection~ModelSelection model selection} exists and is marked in
|
417
|
+
* {@link module:engine/model/schema~ModelSchema schema} as `object`.
|
418
418
|
*
|
419
419
|
* @internal
|
420
420
|
* @param forward Direction of checking.
|
@@ -587,7 +587,7 @@ function findTextBlockAncestor(modelElement, schema) {
|
|
587
587
|
* Returns next text block where could put selection.
|
588
588
|
*/
|
589
589
|
function findNextTextBlock(position, schema) {
|
590
|
-
const treeWalker = new
|
590
|
+
const treeWalker = new ModelTreeWalker({ startPosition: position });
|
591
591
|
for (const { item } of treeWalker) {
|
592
592
|
if (schema.isLimit(item) || !item.is('element')) {
|
593
593
|
return null;
|
package/src/widgetresize.d.ts
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
*/
|
8
8
|
import { WidgetResizer } from './widgetresize/resizer.js';
|
9
9
|
import { Plugin, type Editor } from '@ckeditor/ckeditor5-core';
|
10
|
-
import { type
|
10
|
+
import { type ModelElement, type ViewContainerElement } from '@ckeditor/ckeditor5-engine';
|
11
11
|
import '../theme/widgetresize.css';
|
12
12
|
/**
|
13
13
|
* The widget resize feature plugin.
|
@@ -96,7 +96,7 @@ export interface WidgetResizerOptions {
|
|
96
96
|
* Editor instance associated with the resizer.
|
97
97
|
*/
|
98
98
|
editor: Editor;
|
99
|
-
modelElement:
|
99
|
+
modelElement: ModelElement;
|
100
100
|
/**
|
101
101
|
* A view of an element to be resized. Typically it's the main widget's view instance.
|
102
102
|
*/
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
4
4
|
*/
|
5
|
-
import type {
|
5
|
+
import type { ModelDocumentSelection, ViewDomConverter, ModelElement, ModelSchema, ModelSelection, ViewElement } from '@ckeditor/ckeditor5-engine';
|
6
6
|
/**
|
7
7
|
* The name of the type around model selection attribute responsible for
|
8
8
|
* displaying a fake caret next to a selected widget.
|
@@ -13,7 +13,7 @@ export declare const TYPE_AROUND_SELECTION_ATTRIBUTE = "widget-type-around";
|
|
13
13
|
/**
|
14
14
|
* Checks if an element is a widget that qualifies to get the widget type around UI.
|
15
15
|
*/
|
16
|
-
export declare function isTypeAroundWidget(viewElement: ViewElement | undefined, modelElement:
|
16
|
+
export declare function isTypeAroundWidget(viewElement: ViewElement | undefined, modelElement: ModelElement, schema: ModelSchema): boolean;
|
17
17
|
/**
|
18
18
|
* For the passed HTML element, this helper finds the closest widget type around button ancestor.
|
19
19
|
*
|
@@ -34,7 +34,7 @@ export declare function getTypeAroundButtonPosition(domElement: HTMLElement): 'b
|
|
34
34
|
*
|
35
35
|
* @internal
|
36
36
|
*/
|
37
|
-
export declare function getClosestWidgetViewElement(domElement: HTMLElement, domConverter:
|
37
|
+
export declare function getClosestWidgetViewElement(domElement: HTMLElement, domConverter: ViewDomConverter): ViewElement;
|
38
38
|
/**
|
39
39
|
* For the passed selection instance, it returns the position of the fake caret displayed next to a widget.
|
40
40
|
*
|
@@ -43,4 +43,4 @@ export declare function getClosestWidgetViewElement(domElement: HTMLElement, dom
|
|
43
43
|
* @internal
|
44
44
|
* @returns The position of the fake caret or `null` when none is present.
|
45
45
|
*/
|
46
|
-
export declare function getTypeAroundFakeCaretPosition(selection:
|
46
|
+
export declare function getTypeAroundFakeCaretPosition(selection: ModelSelection | ModelDocumentSelection): 'before' | 'after' | null;
|
@@ -82,7 +82,7 @@ export declare class WidgetTypeAround extends Plugin {
|
|
82
82
|
* Creates a listener in the editing conversion pipeline that injects the widget type around
|
83
83
|
* UI into every single widget instance created in the editor.
|
84
84
|
*
|
85
|
-
* The UI is delivered as a {@link module:engine/view/uielement~
|
85
|
+
* The UI is delivered as a {@link module:engine/view/uielement~ViewUIElement}
|
86
86
|
* wrapper which renders DOM buttons that users can use to insert paragraphs.
|
87
87
|
*/
|
88
88
|
private _enableTypeAroundUIInjection;
|
@@ -165,7 +165,7 @@ export class WidgetTypeAround extends Plugin {
|
|
165
165
|
* Creates a listener in the editing conversion pipeline that injects the widget type around
|
166
166
|
* UI into every single widget instance created in the editor.
|
167
167
|
*
|
168
|
-
* The UI is delivered as a {@link module:engine/view/uielement~
|
168
|
+
* The UI is delivered as a {@link module:engine/view/uielement~ViewUIElement}
|
169
169
|
* wrapper which renders DOM buttons that users can use to insert paragraphs.
|
170
170
|
*/
|
171
171
|
_enableTypeAroundUIInjection() {
|