@ckeditor/ckeditor5-widget 37.0.0-alpha.0 → 37.0.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +22 -22
- package/src/augmentation.d.ts +13 -0
- package/src/augmentation.js +5 -0
- package/src/highlightstack.d.ts +1 -1
- package/src/index.d.ts +4 -0
- package/src/index.js +4 -0
- package/src/verticalnavigation.d.ts +1 -1
- package/src/verticalnavigation.js +1 -1
- package/src/widget.d.ts +0 -5
- package/src/widgetresize/resizer.d.ts +4 -4
- package/src/widgetresize/resizerstate.js +15 -2
- package/src/widgetresize.d.ts +0 -5
- package/src/widgettoolbarrepository.d.ts +1 -6
- package/src/widgettoolbarrepository.js +4 -4
- package/src/widgettypearound/widgettypearound.d.ts +2 -7
- package/src/widgettypearound/widgettypearound.js +2 -2
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-widget",
|
3
|
-
"version": "37.0.0-alpha.
|
3
|
+
"version": "37.0.0-alpha.2",
|
4
4
|
"description": "Widget API for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -11,29 +11,29 @@
|
|
11
11
|
],
|
12
12
|
"main": "src/index.js",
|
13
13
|
"dependencies": {
|
14
|
-
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.
|
15
|
-
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.
|
16
|
-
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.
|
17
|
-
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.
|
18
|
-
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.
|
19
|
-
"@ckeditor/ckeditor5-typing": "^37.0.0-alpha.
|
14
|
+
"@ckeditor/ckeditor5-core": "^37.0.0-alpha.2",
|
15
|
+
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.2",
|
16
|
+
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.2",
|
17
|
+
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.2",
|
18
|
+
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.2",
|
19
|
+
"@ckeditor/ckeditor5-typing": "^37.0.0-alpha.2",
|
20
20
|
"lodash-es": "^4.17.15"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
|
-
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.
|
24
|
-
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.
|
25
|
-
"@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.
|
26
|
-
"@ckeditor/ckeditor5-editor-balloon": "^37.0.0-alpha.
|
27
|
-
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.
|
28
|
-
"@ckeditor/ckeditor5-essentials": "^37.0.0-alpha.
|
29
|
-
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.
|
30
|
-
"@ckeditor/ckeditor5-horizontal-line": "^37.0.0-alpha.
|
31
|
-
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.
|
32
|
-
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.
|
33
|
-
"@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.
|
34
|
-
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.
|
35
|
-
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.
|
36
|
-
"@ckeditor/ckeditor5-undo": "^37.0.0-alpha.
|
23
|
+
"@ckeditor/ckeditor5-basic-styles": "^37.0.0-alpha.2",
|
24
|
+
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.2",
|
25
|
+
"@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.2",
|
26
|
+
"@ckeditor/ckeditor5-editor-balloon": "^37.0.0-alpha.2",
|
27
|
+
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.2",
|
28
|
+
"@ckeditor/ckeditor5-essentials": "^37.0.0-alpha.2",
|
29
|
+
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.2",
|
30
|
+
"@ckeditor/ckeditor5-horizontal-line": "^37.0.0-alpha.2",
|
31
|
+
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.2",
|
32
|
+
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.2",
|
33
|
+
"@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.2",
|
34
|
+
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.2",
|
35
|
+
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.2",
|
36
|
+
"@ckeditor/ckeditor5-undo": "^37.0.0-alpha.2",
|
37
37
|
"typescript": "^4.8.4",
|
38
38
|
"webpack": "^5.58.1",
|
39
39
|
"webpack-cli": "^4.9.0"
|
@@ -60,7 +60,7 @@
|
|
60
60
|
"CHANGELOG.md"
|
61
61
|
],
|
62
62
|
"scripts": {
|
63
|
-
"build": "tsc -p ./tsconfig.
|
63
|
+
"build": "tsc -p ./tsconfig.json",
|
64
64
|
"postversion": "npm run build"
|
65
65
|
},
|
66
66
|
"types": "src/index.d.ts"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import type { Widget, WidgetResize, WidgetToolbarRepository, WidgetTypeAround } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface PluginsMap {
|
8
|
+
[Widget.pluginName]: Widget;
|
9
|
+
[WidgetResize.pluginName]: WidgetResize;
|
10
|
+
[WidgetToolbarRepository.pluginName]: WidgetToolbarRepository;
|
11
|
+
[WidgetTypeAround.pluginName]: WidgetTypeAround;
|
12
|
+
}
|
13
|
+
}
|
package/src/highlightstack.d.ts
CHANGED
@@ -48,7 +48,7 @@ export default class HighlightStack extends HighlightStack_base {
|
|
48
48
|
/**
|
49
49
|
* Fired when top element on {@link module:widget/highlightstack~HighlightStack} has been changed
|
50
50
|
*
|
51
|
-
* @eventName change:top
|
51
|
+
* @eventName ~HighlightStack#change:top
|
52
52
|
*/
|
53
53
|
export type HighlightStackChangeEvent = {
|
54
54
|
name: 'change' | 'change:top';
|
package/src/index.d.ts
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
|
+
/**
|
6
|
+
* @module widget
|
7
|
+
*/
|
5
8
|
export { default as Widget } from './widget';
|
6
9
|
export { default as WidgetToolbarRepository } from './widgettoolbarrepository';
|
7
10
|
export { default as WidgetResize } from './widgetresize';
|
8
11
|
export { default as WidgetTypeAround } from './widgettypearound/widgettypearound';
|
9
12
|
export * from './utils';
|
13
|
+
import './augmentation';
|
package/src/index.js
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
|
+
/**
|
6
|
+
* @module widget
|
7
|
+
*/
|
5
8
|
export { default as Widget } from './widget';
|
6
9
|
export { default as WidgetToolbarRepository } from './widgettoolbarrepository';
|
7
10
|
export { default as WidgetResize } from './widgetresize';
|
8
11
|
export { default as WidgetTypeAround } from './widgettypearound/widgettypearound';
|
9
12
|
export * from './utils';
|
13
|
+
import './augmentation';
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
|
-
* @module widget/
|
6
|
+
* @module widget/verticalnavigation
|
7
7
|
*/
|
8
8
|
import { type GetCallback } from '@ckeditor/ckeditor5-utils';
|
9
9
|
import type { EditingController, ViewDocumentArrowKeyEvent } from '@ckeditor/ckeditor5-engine';
|
package/src/widget.d.ts
CHANGED
@@ -159,19 +159,19 @@ export default class Resizer extends Resizer_base {
|
|
159
159
|
private _appendSizeUI;
|
160
160
|
}
|
161
161
|
/**
|
162
|
-
* @eventName begin
|
162
|
+
* @eventName ~Resizer#begin
|
163
163
|
*/
|
164
164
|
export type ResizerBeginEvent = DecoratedMethodEvent<Resizer, 'begin'>;
|
165
165
|
/**
|
166
|
-
* @eventName cancel
|
166
|
+
* @eventName ~Resizer#cancel
|
167
167
|
*/
|
168
168
|
export type ResizerCancelEvent = DecoratedMethodEvent<Resizer, 'cancel'>;
|
169
169
|
/**
|
170
|
-
* @eventName commit
|
170
|
+
* @eventName ~Resizer#commit
|
171
171
|
*/
|
172
172
|
export type ResizerCommitEvent = DecoratedMethodEvent<Resizer, 'commit'>;
|
173
173
|
/**
|
174
|
-
* @eventName updateSize
|
174
|
+
* @eventName ~Resizer#updateSize
|
175
175
|
*/
|
176
176
|
export type ResizerUpdateSizeEvent = DecoratedMethodEvent<Resizer, 'updateSize'>;
|
177
177
|
export {};
|
@@ -76,12 +76,25 @@ export default class ResizeState extends ObservableMixin() {
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
/**
|
79
|
-
* Calculates a relative width of a `domResizeHost` compared to
|
79
|
+
* Calculates a relative width of a `domResizeHost` compared to its ancestor in percents.
|
80
80
|
*/
|
81
81
|
function calculateHostPercentageWidth(domResizeHost, resizeHostRect) {
|
82
82
|
const domResizeHostParent = domResizeHost.parentElement;
|
83
83
|
// Need to use computed style as it properly excludes parent's paddings from the returned value.
|
84
|
-
|
84
|
+
let parentWidth = parseFloat(domResizeHostParent.ownerDocument.defaultView.getComputedStyle(domResizeHostParent).width);
|
85
|
+
// Sometimes parent width cannot be accessed. If that happens we should go up in the elements tree
|
86
|
+
// and try to get width from next ancestor.
|
87
|
+
// https://github.com/ckeditor/ckeditor5/issues/10776
|
88
|
+
const ancestorLevelLimit = 5;
|
89
|
+
let currentLevel = 0;
|
90
|
+
let checkedElement = domResizeHostParent;
|
91
|
+
while (isNaN(parentWidth)) {
|
92
|
+
checkedElement = checkedElement.parentElement;
|
93
|
+
if (++currentLevel > ancestorLevelLimit) {
|
94
|
+
return 0;
|
95
|
+
}
|
96
|
+
parentWidth = parseFloat(domResizeHostParent.ownerDocument.defaultView.getComputedStyle(checkedElement).width);
|
97
|
+
}
|
85
98
|
return resizeHostRect.width / parentWidth * 100;
|
86
99
|
}
|
87
100
|
/**
|
package/src/widgetresize.d.ts
CHANGED
@@ -123,8 +123,3 @@ export interface ResizerOptions {
|
|
123
123
|
getHandleHost: (widgetWrapper: HTMLElement) => HTMLElement;
|
124
124
|
isCentered?: (resizer: Resizer) => boolean;
|
125
125
|
}
|
126
|
-
declare module '@ckeditor/ckeditor5-core' {
|
127
|
-
interface PluginsMap {
|
128
|
-
[WidgetResize.pluginName]: WidgetResize;
|
129
|
-
}
|
130
|
-
}
|
@@ -85,14 +85,9 @@ export default class WidgetToolbarRepository extends Plugin {
|
|
85
85
|
* Otherwise, repositions the toolbar's balloon when toolbar's view is the most top view in balloon stack.
|
86
86
|
*
|
87
87
|
* It might happen here that the toolbar's view is under another view. Then do nothing as the other toolbar view
|
88
|
-
* should be still visible after the {@link module:
|
88
|
+
* should be still visible after the {@link module:ui/editorui/editorui~EditorUI#event:update}.
|
89
89
|
*/
|
90
90
|
private _showToolbar;
|
91
91
|
private _isToolbarVisible;
|
92
92
|
private _isToolbarInBalloon;
|
93
93
|
}
|
94
|
-
declare module '@ckeditor/ckeditor5-core' {
|
95
|
-
interface PluginsMap {
|
96
|
-
[WidgetToolbarRepository.pluginName]: WidgetToolbarRepository;
|
97
|
-
}
|
98
|
-
}
|
@@ -105,14 +105,14 @@ export default class WidgetToolbarRepository extends Plugin {
|
|
105
105
|
// Trying to register a toolbar without any item.
|
106
106
|
if (!items.length) {
|
107
107
|
/**
|
108
|
-
* When {@link #register registering} a new widget toolbar, you
|
109
|
-
* the items that will be inserted into the toolbar.
|
108
|
+
* When {@link module:widget/widgettoolbarrepository~WidgetToolbarRepository#register registering} a new widget toolbar, you
|
109
|
+
* need to provide a non-empty array with the items that will be inserted into the toolbar.
|
110
110
|
*
|
111
111
|
* If you see this error when integrating the editor, you likely forgot to configure one of the widget toolbars.
|
112
112
|
*
|
113
113
|
* See for instance:
|
114
114
|
*
|
115
|
-
* * {@link module:table/
|
115
|
+
* * {@link module:table/tableconfig~TableConfig#contentToolbar `config.table.contentToolbar`}
|
116
116
|
* * {@link module:image/imageconfig~ImageConfig#toolbar `config.image.toolbar`}
|
117
117
|
*
|
118
118
|
* @error widget-toolbar-no-items
|
@@ -204,7 +204,7 @@ export default class WidgetToolbarRepository extends Plugin {
|
|
204
204
|
* Otherwise, repositions the toolbar's balloon when toolbar's view is the most top view in balloon stack.
|
205
205
|
*
|
206
206
|
* It might happen here that the toolbar's view is under another view. Then do nothing as the other toolbar view
|
207
|
-
* should be still visible after the {@link module:
|
207
|
+
* should be still visible after the {@link module:ui/editorui/editorui~EditorUI#event:update}.
|
208
208
|
*/
|
209
209
|
_showToolbar(toolbarDefinition, relatedElement) {
|
210
210
|
if (this._isToolbarVisible(toolbarDefinition)) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
4
|
*/
|
5
5
|
/**
|
6
|
-
* @module widget/widgettypearound
|
6
|
+
* @module widget/widgettypearound/widgettypearound
|
7
7
|
*/
|
8
8
|
import { Plugin, type PluginDependencies } from '@ckeditor/ckeditor5-core';
|
9
9
|
import '../../theme/widgettypearound.css';
|
@@ -51,7 +51,7 @@ export default class WidgetTypeAround extends Plugin {
|
|
51
51
|
*/
|
52
52
|
private _insertParagraph;
|
53
53
|
/**
|
54
|
-
* A wrapper for the {@link module:utils/emittermixin~
|
54
|
+
* A wrapper for the {@link module:utils/emittermixin~Emitter#listenTo} method that executes the callbacks only
|
55
55
|
* when the plugin {@link #isEnabled is enabled}.
|
56
56
|
*
|
57
57
|
* @param emitter The object that fires the event.
|
@@ -225,8 +225,3 @@ export default class WidgetTypeAround extends Plugin {
|
|
225
225
|
*/
|
226
226
|
private _enableDeleteContentIntegration;
|
227
227
|
}
|
228
|
-
declare module '@ckeditor/ckeditor5-core' {
|
229
|
-
interface PluginsMap {
|
230
|
-
[WidgetTypeAround.pluginName]: WidgetTypeAround;
|
231
|
-
}
|
232
|
-
}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
*/
|
5
5
|
/* global DOMParser */
|
6
6
|
/**
|
7
|
-
* @module widget/widgettypearound
|
7
|
+
* @module widget/widgettypearound/widgettypearound
|
8
8
|
*/
|
9
9
|
import { Plugin } from '@ckeditor/ckeditor5-core';
|
10
10
|
import { Template } from '@ckeditor/ckeditor5-ui';
|
@@ -114,7 +114,7 @@ export default class WidgetTypeAround extends Plugin {
|
|
114
114
|
editingView.scrollToTheSelection();
|
115
115
|
}
|
116
116
|
/**
|
117
|
-
* A wrapper for the {@link module:utils/emittermixin~
|
117
|
+
* A wrapper for the {@link module:utils/emittermixin~Emitter#listenTo} method that executes the callbacks only
|
118
118
|
* when the plugin {@link #isEnabled is enabled}.
|
119
119
|
*
|
120
120
|
* @param emitter The object that fires the event.
|