@ckeditor/ckeditor5-widget 37.0.0-alpha.1 → 37.0.0-alpha.3
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/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.3",
|
|
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.3",
|
|
15
|
+
"@ckeditor/ckeditor5-engine": "^37.0.0-alpha.3",
|
|
16
|
+
"@ckeditor/ckeditor5-enter": "^37.0.0-alpha.3",
|
|
17
|
+
"@ckeditor/ckeditor5-ui": "^37.0.0-alpha.3",
|
|
18
|
+
"@ckeditor/ckeditor5-utils": "^37.0.0-alpha.3",
|
|
19
|
+
"@ckeditor/ckeditor5-typing": "^37.0.0-alpha.3",
|
|
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.3",
|
|
24
|
+
"@ckeditor/ckeditor5-block-quote": "^37.0.0-alpha.3",
|
|
25
|
+
"@ckeditor/ckeditor5-clipboard": "^37.0.0-alpha.3",
|
|
26
|
+
"@ckeditor/ckeditor5-editor-balloon": "^37.0.0-alpha.3",
|
|
27
|
+
"@ckeditor/ckeditor5-editor-classic": "^37.0.0-alpha.3",
|
|
28
|
+
"@ckeditor/ckeditor5-essentials": "^37.0.0-alpha.3",
|
|
29
|
+
"@ckeditor/ckeditor5-heading": "^37.0.0-alpha.3",
|
|
30
|
+
"@ckeditor/ckeditor5-horizontal-line": "^37.0.0-alpha.3",
|
|
31
|
+
"@ckeditor/ckeditor5-image": "^37.0.0-alpha.3",
|
|
32
|
+
"@ckeditor/ckeditor5-link": "^37.0.0-alpha.3",
|
|
33
|
+
"@ckeditor/ckeditor5-media-embed": "^37.0.0-alpha.3",
|
|
34
|
+
"@ckeditor/ckeditor5-paragraph": "^37.0.0-alpha.3",
|
|
35
|
+
"@ckeditor/ckeditor5-table": "^37.0.0-alpha.3",
|
|
36
|
+
"@ckeditor/ckeditor5-undo": "^37.0.0-alpha.3",
|
|
37
37
|
"typescript": "^4.8.4",
|
|
38
38
|
"webpack": "^5.58.1",
|
|
39
39
|
"webpack-cli": "^4.9.0"
|
package/src/widget.d.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module widget/widget
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin
|
|
8
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
9
9
|
import { type Element, type Node } from '@ckeditor/ckeditor5-engine';
|
|
10
|
+
import { Delete } from '@ckeditor/ckeditor5-typing';
|
|
11
|
+
import WidgetTypeAround from './widgettypearound/widgettypearound';
|
|
10
12
|
import '../theme/widget.css';
|
|
11
13
|
/**
|
|
12
14
|
* The widget plugin. It enables base support for widgets.
|
|
@@ -33,7 +35,7 @@ export default class Widget extends Plugin {
|
|
|
33
35
|
/**
|
|
34
36
|
* @inheritDoc
|
|
35
37
|
*/
|
|
36
|
-
static get requires():
|
|
38
|
+
static get requires(): readonly [typeof WidgetTypeAround, typeof Delete];
|
|
37
39
|
/**
|
|
38
40
|
* @inheritDoc
|
|
39
41
|
*/
|
|
@@ -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
|
/**
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module widget/widgettoolbarrepository
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin, type
|
|
8
|
+
import { Plugin, type ToolbarConfigItem } from '@ckeditor/ckeditor5-core';
|
|
9
9
|
import type { ViewDocumentSelection, ViewElement } from '@ckeditor/ckeditor5-engine';
|
|
10
|
+
import { ContextualBalloon } from '@ckeditor/ckeditor5-ui';
|
|
10
11
|
/**
|
|
11
12
|
* Widget toolbar repository plugin. A central point for registering widget toolbars. This plugin handles the whole
|
|
12
13
|
* toolbar rendering process and exposes a concise API.
|
|
@@ -42,7 +43,7 @@ export default class WidgetToolbarRepository extends Plugin {
|
|
|
42
43
|
/**
|
|
43
44
|
* @inheritDoc
|
|
44
45
|
*/
|
|
45
|
-
static get requires():
|
|
46
|
+
static get requires(): readonly [typeof ContextualBalloon];
|
|
46
47
|
/**
|
|
47
48
|
* @inheritDoc
|
|
48
49
|
*/
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module widget/widgettypearound/widgettypearound
|
|
7
7
|
*/
|
|
8
|
-
import { Plugin
|
|
8
|
+
import { Plugin } from '@ckeditor/ckeditor5-core';
|
|
9
|
+
import { Enter } from '@ckeditor/ckeditor5-enter';
|
|
10
|
+
import { Delete } from '@ckeditor/ckeditor5-typing';
|
|
9
11
|
import '../../theme/widgettypearound.css';
|
|
10
12
|
/**
|
|
11
13
|
* A plugin that allows users to type around widgets where normally it is impossible to place the caret due
|
|
@@ -31,7 +33,7 @@ export default class WidgetTypeAround extends Plugin {
|
|
|
31
33
|
/**
|
|
32
34
|
* @inheritDoc
|
|
33
35
|
*/
|
|
34
|
-
static get requires():
|
|
36
|
+
static get requires(): readonly [typeof Enter, typeof Delete];
|
|
35
37
|
/**
|
|
36
38
|
* @inheritDoc
|
|
37
39
|
*/
|