@ckeditor/ckeditor5-widget 37.0.0-alpha.1 → 37.0.0-alpha.2
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 +21 -21
- package/src/widgetresize/resizerstate.js +15 -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"
|
|
@@ -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
|
/**
|