@ckeditor/ckeditor5-widget 0.0.0-nightly-20250613.0 → 0.0.0-nightly-20250614.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 +10 -10
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/highlightstack.d.ts +7 -7
- package/src/highlightstack.js +1 -1
- package/src/index.d.ts +5 -2
- package/src/index.js +4 -1
- package/src/utils.d.ts +1 -1
- package/src/utils.js +3 -3
- package/src/verticalnavigation.d.ts +1 -1
- package/src/verticalnavigation.js +1 -1
- package/src/widget.js +2 -2
- package/src/widgetresize/resizer.d.ts +13 -13
- package/src/widgetresize/resizer.js +2 -2
- package/src/widgetresize/resizerstate.d.ts +2 -2
- package/src/widgetresize/sizeview.d.ts +2 -2
- package/src/widgetresize.d.ts +8 -8
- package/src/widgetresize.js +3 -3
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-20250614.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-20250614.0",
|
16
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250614.0",
|
17
|
+
"@ckeditor/ckeditor5-enter": "0.0.0-nightly-20250614.0",
|
18
|
+
"@ckeditor/ckeditor5-icons": "0.0.0-nightly-20250614.0",
|
19
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250614.0",
|
20
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250614.0",
|
21
|
+
"@ckeditor/ckeditor5-typing": "0.0.0-nightly-20250614.0",
|
22
22
|
"es-toolkit": "1.38.0"
|
23
23
|
},
|
24
24
|
"author": "CKSource (http://cksource.com/)",
|
package/src/highlightstack.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 type { DowncastWriter, HighlightDescriptor } from '@ckeditor/ckeditor5-engine';
|
6
|
-
declare const
|
6
|
+
declare const WidgetHighlightStack_base: {
|
7
7
|
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
8
8
|
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
9
9
|
};
|
@@ -18,7 +18,7 @@ declare const HighlightStack_base: {
|
|
18
18
|
*
|
19
19
|
* This way, highlight will be applied with the same rules it is applied on texts.
|
20
20
|
*/
|
21
|
-
export declare class
|
21
|
+
export declare class WidgetHighlightStack extends /* #__PURE__ */ WidgetHighlightStack_base {
|
22
22
|
private readonly _stack;
|
23
23
|
/**
|
24
24
|
* Adds highlight descriptor to the stack.
|
@@ -46,18 +46,18 @@ export declare class HighlightStack extends /* #__PURE__ */ HighlightStack_base
|
|
46
46
|
private _removeDescriptor;
|
47
47
|
}
|
48
48
|
/**
|
49
|
-
* Fired when top element on {@link module:widget/highlightstack~
|
49
|
+
* Fired when top element on {@link module:widget/highlightstack~WidgetHighlightStack} has been changed
|
50
50
|
*
|
51
|
-
* @eventName ~
|
51
|
+
* @eventName ~WidgetHighlightStack#change:top
|
52
52
|
*/
|
53
|
-
export type
|
53
|
+
export type WidgetHighlightStackChangeEvent = {
|
54
54
|
name: 'change' | 'change:top';
|
55
|
-
args: [
|
55
|
+
args: [WidgetHighlightStackChangeEventData];
|
56
56
|
};
|
57
57
|
/**
|
58
58
|
* Additional information about the change.
|
59
59
|
*/
|
60
|
-
export type
|
60
|
+
export type WidgetHighlightStackChangeEventData = {
|
61
61
|
/**
|
62
62
|
* Old highlight descriptor. It will be `undefined` when first descriptor is added to the stack.
|
63
63
|
*/
|
package/src/highlightstack.js
CHANGED
@@ -17,7 +17,7 @@ import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
17
17
|
*
|
18
18
|
* This way, highlight will be applied with the same rules it is applied on texts.
|
19
19
|
*/
|
20
|
-
export class
|
20
|
+
export class WidgetHighlightStack extends /* #__PURE__ */ EmitterMixin() {
|
21
21
|
_stack = [];
|
22
22
|
/**
|
23
23
|
* Adds highlight descriptor to the stack.
|
package/src/index.d.ts
CHANGED
@@ -7,9 +7,12 @@
|
|
7
7
|
*/
|
8
8
|
export { Widget } from './widget.js';
|
9
9
|
export { WidgetToolbarRepository } from './widgettoolbarrepository.js';
|
10
|
-
export { WidgetResize } from './widgetresize.js';
|
10
|
+
export { WidgetResize, type WidgetResizerOptions } from './widgetresize.js';
|
11
11
|
export { WidgetTypeAround } from './widgettypearound/widgettypearound.js';
|
12
12
|
export { WIDGET_CLASS_NAME, WIDGET_SELECTED_CLASS_NAME, isWidget, toWidget, setHighlightHandling, setLabel, getLabel, toWidgetEditable, findOptimalInsertionRange, viewToModelPositionOutsideModelElement, calculateResizeHostAncestorWidth, calculateResizeHostPercentageWidth } from './utils.js';
|
13
|
+
export { WidgetHighlightStack, type WidgetHighlightStackChangeEvent, type WidgetHighlightStackChangeEventData } from './highlightstack.js';
|
14
|
+
export { verticalWidgetNavigationHandler } from './verticalnavigation.js';
|
15
|
+
export { WidgetResizer, type WidgetResizerBeginEvent, type WidgetResizerCancelEvent, type WidgetResizerCommitEvent, type WidgetResizerUpdateSizeEvent } from './widgetresize/resizer.js';
|
13
16
|
export { SizeView as _WidgetSizeView } from './widgetresize/sizeview.js';
|
14
|
-
export { TYPE_AROUND_SELECTION_ATTRIBUTE as _WIDGET_TYPE_AROUND_SELECTION_ATTRIBUTE, getClosestTypeAroundDomButton as _getClosestWidgetTypeAroundDomButton, getTypeAroundButtonPosition as _getWidgetTypeAroundButtonPosition, getClosestWidgetViewElement as _getClosestWidgetViewElement, getTypeAroundFakeCaretPosition as _getWidgetTypeAroundFakeCaretPosition } from './widgettypearound/utils.js';
|
17
|
+
export { TYPE_AROUND_SELECTION_ATTRIBUTE as _WIDGET_TYPE_AROUND_SELECTION_ATTRIBUTE, getClosestTypeAroundDomButton as _getClosestWidgetTypeAroundDomButton, getTypeAroundButtonPosition as _getWidgetTypeAroundButtonPosition, getClosestWidgetViewElement as _getClosestWidgetViewElement, getTypeAroundFakeCaretPosition as _getWidgetTypeAroundFakeCaretPosition, isTypeAroundWidget } from './widgettypearound/utils.js';
|
15
18
|
import './augmentation.js';
|
package/src/index.js
CHANGED
@@ -10,6 +10,9 @@ export { WidgetToolbarRepository } from './widgettoolbarrepository.js';
|
|
10
10
|
export { WidgetResize } from './widgetresize.js';
|
11
11
|
export { WidgetTypeAround } from './widgettypearound/widgettypearound.js';
|
12
12
|
export { WIDGET_CLASS_NAME, WIDGET_SELECTED_CLASS_NAME, isWidget, toWidget, setHighlightHandling, setLabel, getLabel, toWidgetEditable, findOptimalInsertionRange, viewToModelPositionOutsideModelElement, calculateResizeHostAncestorWidth, calculateResizeHostPercentageWidth } from './utils.js';
|
13
|
+
export { WidgetHighlightStack } from './highlightstack.js';
|
14
|
+
export { verticalWidgetNavigationHandler } from './verticalnavigation.js';
|
15
|
+
export { WidgetResizer } from './widgetresize/resizer.js';
|
13
16
|
export { SizeView as _WidgetSizeView } from './widgetresize/sizeview.js';
|
14
|
-
export { TYPE_AROUND_SELECTION_ATTRIBUTE as _WIDGET_TYPE_AROUND_SELECTION_ATTRIBUTE, getClosestTypeAroundDomButton as _getClosestWidgetTypeAroundDomButton, getTypeAroundButtonPosition as _getWidgetTypeAroundButtonPosition, getClosestWidgetViewElement as _getClosestWidgetViewElement, getTypeAroundFakeCaretPosition as _getWidgetTypeAroundFakeCaretPosition } from './widgettypearound/utils.js';
|
17
|
+
export { TYPE_AROUND_SELECTION_ATTRIBUTE as _WIDGET_TYPE_AROUND_SELECTION_ATTRIBUTE, getClosestTypeAroundDomButton as _getClosestWidgetTypeAroundDomButton, getTypeAroundButtonPosition as _getWidgetTypeAroundButtonPosition, getClosestWidgetViewElement as _getClosestWidgetViewElement, getTypeAroundFakeCaretPosition as _getWidgetTypeAroundFakeCaretPosition, isTypeAroundWidget } from './widgettypearound/utils.js';
|
15
18
|
import './augmentation.js';
|
package/src/utils.d.ts
CHANGED
@@ -67,7 +67,7 @@ export declare function toWidget(element: ViewElement, writer: DowncastWriter, o
|
|
67
67
|
hasSelectionHandle?: boolean;
|
68
68
|
}): ViewElement;
|
69
69
|
/**
|
70
|
-
* Sets highlight handling methods. Uses {@link module:widget/highlightstack~
|
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
73
|
export declare function setHighlightHandling(element: ViewElement, writer: DowncastWriter, add?: (element: ViewElement, descriptor: HighlightDescriptor, writer: DowncastWriter) => void, remove?: (element: ViewElement, descriptor: HighlightDescriptor, writer: DowncastWriter) => void): void;
|
package/src/utils.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
import { IconDragHandle } from '@ckeditor/ckeditor5-icons';
|
9
9
|
import { Rect, CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';
|
10
10
|
import { IconView } from '@ckeditor/ckeditor5-ui';
|
11
|
-
import {
|
11
|
+
import { WidgetHighlightStack } from './highlightstack.js';
|
12
12
|
import { getTypeAroundFakeCaretPosition } from './widgettypearound/utils.js';
|
13
13
|
/**
|
14
14
|
* CSS class added to each widget element.
|
@@ -127,11 +127,11 @@ function removeHighlight(element, descriptor, writer) {
|
|
127
127
|
}
|
128
128
|
}
|
129
129
|
/**
|
130
|
-
* Sets highlight handling methods. Uses {@link module:widget/highlightstack~
|
130
|
+
* Sets highlight handling methods. Uses {@link module:widget/highlightstack~WidgetHighlightStack} to
|
131
131
|
* properly determine which highlight descriptor should be used at given time.
|
132
132
|
*/
|
133
133
|
export function setHighlightHandling(element, writer, add = addHighlight, remove = removeHighlight) {
|
134
|
-
const stack = new
|
134
|
+
const stack = new WidgetHighlightStack();
|
135
135
|
stack.on('change:top', (evt, data) => {
|
136
136
|
if (data.oldDescriptor) {
|
137
137
|
remove(element, data.oldDescriptor, data.writer);
|
@@ -12,4 +12,4 @@ import type { EditingController, ViewDocumentArrowKeyEvent } from '@ckeditor/cke
|
|
12
12
|
*
|
13
13
|
* @param editing The editing controller.
|
14
14
|
*/
|
15
|
-
export declare function
|
15
|
+
export declare function verticalWidgetNavigationHandler(editing: EditingController): GetCallback<ViewDocumentArrowKeyEvent>;
|
@@ -11,7 +11,7 @@ import { keyCodes, Rect } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
*
|
12
12
|
* @param editing The editing controller.
|
13
13
|
*/
|
14
|
-
export function
|
14
|
+
export function verticalWidgetNavigationHandler(editing) {
|
15
15
|
const model = editing.model;
|
16
16
|
return (evt, data) => {
|
17
17
|
const arrowUpPressed = data.keyCode == keyCodes.arrowup;
|
package/src/widget.js
CHANGED
@@ -10,7 +10,7 @@ import { MouseObserver, TreeWalker } 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';
|
13
|
-
import {
|
13
|
+
import { verticalWidgetNavigationHandler } from './verticalnavigation.js';
|
14
14
|
import { getLabel, isWidget, WIDGET_SELECTED_CLASS_NAME } from './utils.js';
|
15
15
|
import '../theme/widget.css';
|
16
16
|
/**
|
@@ -141,7 +141,7 @@ export class Widget extends Plugin {
|
|
141
141
|
this.listenTo(viewDocument, 'arrowKey', (...args) => {
|
142
142
|
this._preventDefaultOnArrowKeyPress(...args);
|
143
143
|
}, { context: '$root' });
|
144
|
-
this.listenTo(viewDocument, 'arrowKey',
|
144
|
+
this.listenTo(viewDocument, 'arrowKey', verticalWidgetNavigationHandler(this.editor.editing), { context: '$text' });
|
145
145
|
// Handle custom delete behaviour.
|
146
146
|
this.listenTo(viewDocument, 'delete', (evt, data) => {
|
147
147
|
if (this._handleDelete(data.direction == 'forward')) {
|
@@ -4,15 +4,15 @@
|
|
4
4
|
*/
|
5
5
|
import { Rect, type DecoratedMethodEvent } from '@ckeditor/ckeditor5-utils';
|
6
6
|
import { ResizeState } from './resizerstate.js';
|
7
|
-
import type {
|
8
|
-
declare const
|
7
|
+
import type { WidgetResizerOptions } from '../widgetresize.js';
|
8
|
+
declare const WidgetResizer_base: {
|
9
9
|
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
10
10
|
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
11
11
|
};
|
12
12
|
/**
|
13
13
|
* Represents a resizer for a single resizable object.
|
14
14
|
*/
|
15
|
-
export declare class
|
15
|
+
export declare class WidgetResizer extends /* #__PURE__ */ WidgetResizer_base {
|
16
16
|
/**
|
17
17
|
* Flag that indicates whether resizer can be used.
|
18
18
|
*
|
@@ -51,13 +51,13 @@ export declare class Resizer extends /* #__PURE__ */ Resizer_base {
|
|
51
51
|
*/
|
52
52
|
private _viewResizerWrapper;
|
53
53
|
/**
|
54
|
-
* The width of the resized {@link module:widget/widgetresize~
|
54
|
+
* The width of the resized {@link module:widget/widgetresize~WidgetResizerOptions#viewElement viewElement} before the resizing started.
|
55
55
|
*/
|
56
56
|
private _initialViewWidth;
|
57
57
|
/**
|
58
58
|
* @param options Resizer options.
|
59
59
|
*/
|
60
|
-
constructor(options:
|
60
|
+
constructor(options: WidgetResizerOptions);
|
61
61
|
/**
|
62
62
|
* Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.
|
63
63
|
*
|
@@ -159,19 +159,19 @@ export declare class Resizer extends /* #__PURE__ */ Resizer_base {
|
|
159
159
|
private _appendSizeUI;
|
160
160
|
}
|
161
161
|
/**
|
162
|
-
* @eventName ~
|
162
|
+
* @eventName ~WidgetResizer#begin
|
163
163
|
*/
|
164
|
-
export type
|
164
|
+
export type WidgetResizerBeginEvent = DecoratedMethodEvent<WidgetResizer, 'begin'>;
|
165
165
|
/**
|
166
|
-
* @eventName ~
|
166
|
+
* @eventName ~WidgetResizer#cancel
|
167
167
|
*/
|
168
|
-
export type
|
168
|
+
export type WidgetResizerCancelEvent = DecoratedMethodEvent<WidgetResizer, 'cancel'>;
|
169
169
|
/**
|
170
|
-
* @eventName ~
|
170
|
+
* @eventName ~WidgetResizer#commit
|
171
171
|
*/
|
172
|
-
export type
|
172
|
+
export type WidgetResizerCommitEvent = DecoratedMethodEvent<WidgetResizer, 'commit'>;
|
173
173
|
/**
|
174
|
-
* @eventName ~
|
174
|
+
* @eventName ~WidgetResizer#updateSize
|
175
175
|
*/
|
176
|
-
export type
|
176
|
+
export type WidgetResizerUpdateSizeEvent = DecoratedMethodEvent<WidgetResizer, 'updateSize'>;
|
177
177
|
export {};
|
@@ -12,7 +12,7 @@ import { SizeView } from './sizeview.js';
|
|
12
12
|
/**
|
13
13
|
* Represents a resizer for a single resizable object.
|
14
14
|
*/
|
15
|
-
export class
|
15
|
+
export class WidgetResizer extends /* #__PURE__ */ ObservableMixin() {
|
16
16
|
/**
|
17
17
|
* Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.
|
18
18
|
*
|
@@ -32,7 +32,7 @@ export class Resizer extends /* #__PURE__ */ ObservableMixin() {
|
|
32
32
|
*/
|
33
33
|
_viewResizerWrapper = null;
|
34
34
|
/**
|
35
|
-
* The width of the resized {@link module:widget/widgetresize~
|
35
|
+
* The width of the resized {@link module:widget/widgetresize~WidgetResizerOptions#viewElement viewElement} before the resizing started.
|
36
36
|
*/
|
37
37
|
_initialViewWidth;
|
38
38
|
/**
|
@@ -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 { WidgetResizerOptions } from '../widgetresize.js';
|
6
6
|
declare const ResizeState_base: {
|
7
7
|
new (): import("@ckeditor/ckeditor5-utils").Observable;
|
8
8
|
prototype: import("@ckeditor/ckeditor5-utils").Observable;
|
@@ -92,7 +92,7 @@ export declare class ResizeState extends /* #__PURE__ */ ResizeState_base {
|
|
92
92
|
/**
|
93
93
|
* @param options Resizer options.
|
94
94
|
*/
|
95
|
-
constructor(options:
|
95
|
+
constructor(options: WidgetResizerOptions);
|
96
96
|
/**
|
97
97
|
* The original width (pixels) of the resized object when the resize process was started.
|
98
98
|
*/
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* @module widget/widgetresize/sizeview
|
7
7
|
*/
|
8
8
|
import { View } from '@ckeditor/ckeditor5-ui';
|
9
|
-
import type {
|
9
|
+
import type { WidgetResizerOptions } from '../widgetresize.js';
|
10
10
|
import { type ResizeState } from './resizerstate.js';
|
11
11
|
/**
|
12
12
|
* A view displaying the proposed new element size during the resizing.
|
@@ -47,7 +47,7 @@ export declare class SizeView extends View {
|
|
47
47
|
* @param options An object defining the resizer options, used for setting the proper size label.
|
48
48
|
* @param resizeState The `ResizeState` class instance, used for keeping the `SizeView` state up to date.
|
49
49
|
*/
|
50
|
-
_bindToState(options:
|
50
|
+
_bindToState(options: WidgetResizerOptions, resizeState: ResizeState): void;
|
51
51
|
/**
|
52
52
|
* A method used for cleaning up. It removes the bindings and hides the view.
|
53
53
|
*
|
package/src/widgetresize.d.ts
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
/**
|
6
6
|
* @module widget/widgetresize
|
7
7
|
*/
|
8
|
-
import {
|
8
|
+
import { WidgetResizer } from './widgetresize/resizer.js';
|
9
9
|
import { Plugin, type Editor } from '@ckeditor/ckeditor5-core';
|
10
10
|
import { type Element, type ViewContainerElement } from '@ckeditor/ckeditor5-engine';
|
11
11
|
import '../theme/widgetresize.css';
|
@@ -20,7 +20,7 @@ export declare class WidgetResize extends Plugin {
|
|
20
20
|
*
|
21
21
|
* @observable
|
22
22
|
*/
|
23
|
-
selectedResizer:
|
23
|
+
selectedResizer: WidgetResizer | null;
|
24
24
|
/**
|
25
25
|
* References an active resizer.
|
26
26
|
*
|
@@ -29,7 +29,7 @@ export declare class WidgetResize extends Plugin {
|
|
29
29
|
* @internal
|
30
30
|
* @observable
|
31
31
|
*/
|
32
|
-
_activeResizer:
|
32
|
+
_activeResizer: WidgetResizer | null;
|
33
33
|
/**
|
34
34
|
* A map of resizers created using this plugin instance.
|
35
35
|
*/
|
@@ -59,7 +59,7 @@ export declare class WidgetResize extends Plugin {
|
|
59
59
|
/**
|
60
60
|
* Marks resizer as selected.
|
61
61
|
*/
|
62
|
-
select(resizer:
|
62
|
+
select(resizer: WidgetResizer): void;
|
63
63
|
/**
|
64
64
|
* Deselects currently set resizer.
|
65
65
|
*/
|
@@ -67,13 +67,13 @@ export declare class WidgetResize extends Plugin {
|
|
67
67
|
/**
|
68
68
|
* @param options Resizer options.
|
69
69
|
*/
|
70
|
-
attachTo(options:
|
70
|
+
attachTo(options: WidgetResizerOptions): WidgetResizer;
|
71
71
|
/**
|
72
72
|
* Returns a resizer created for a given view element (widget element).
|
73
73
|
*
|
74
74
|
* @param viewElement View element associated with the resizer.
|
75
75
|
*/
|
76
|
-
getResizerByViewElement(viewElement: ViewContainerElement):
|
76
|
+
getResizerByViewElement(viewElement: ViewContainerElement): WidgetResizer | undefined;
|
77
77
|
/**
|
78
78
|
* Returns a resizer that contains a given resize handle.
|
79
79
|
*/
|
@@ -91,7 +91,7 @@ export declare class WidgetResize extends Plugin {
|
|
91
91
|
/**
|
92
92
|
* Interface describing a resizer. It allows to specify the resizing host, custom logic for calculating aspect ratio, etc.
|
93
93
|
*/
|
94
|
-
export interface
|
94
|
+
export interface WidgetResizerOptions {
|
95
95
|
/**
|
96
96
|
* Editor instance associated with the resizer.
|
97
97
|
*/
|
@@ -125,5 +125,5 @@ export interface ResizerOptions {
|
|
125
125
|
onCommit: (newValue: string) => void;
|
126
126
|
getResizeHost: (widgetWrapper: HTMLElement) => HTMLElement;
|
127
127
|
getHandleHost: (widgetWrapper: HTMLElement) => HTMLElement;
|
128
|
-
isCentered?: (resizer:
|
128
|
+
isCentered?: (resizer: WidgetResizer) => boolean;
|
129
129
|
}
|
package/src/widgetresize.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
/**
|
6
6
|
* @module widget/widgetresize
|
7
7
|
*/
|
8
|
-
import {
|
8
|
+
import { WidgetResizer } from './widgetresize/resizer.js';
|
9
9
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
10
10
|
import { MouseObserver } from '@ckeditor/ckeditor5-engine';
|
11
11
|
import { DomEmitterMixin, global } from '@ckeditor/ckeditor5-utils';
|
@@ -116,7 +116,7 @@ export class WidgetResize extends Plugin {
|
|
116
116
|
* @param options Resizer options.
|
117
117
|
*/
|
118
118
|
attachTo(options) {
|
119
|
-
const resizer = new
|
119
|
+
const resizer = new WidgetResizer(options);
|
120
120
|
const plugins = this.editor.plugins;
|
121
121
|
resizer.attach();
|
122
122
|
if (plugins.has('WidgetToolbarRepository')) {
|
@@ -165,7 +165,7 @@ export class WidgetResize extends Plugin {
|
|
165
165
|
*/
|
166
166
|
_mouseDownListener(event, domEventData) {
|
167
167
|
const resizeHandle = domEventData.domTarget;
|
168
|
-
if (!
|
168
|
+
if (!WidgetResizer.isResizeHandle(resizeHandle)) {
|
169
169
|
return;
|
170
170
|
}
|
171
171
|
this._activeResizer = this._getResizerByHandle(resizeHandle) || null;
|