@ckeditor/ckeditor5-widget 0.0.0-nightly-20240507.0 → 0.0.0-nightly-20240509.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 +14 -6
- package/dist/index.js.map +1 -1
- package/dist/types/highlightstack.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/widgetresize/resizer.d.ts +1 -1
- package/dist/types/widgetresize/resizerstate.d.ts +1 -1
- package/lang/contexts.json +2 -1
- package/package.json +7 -7
- package/src/highlightstack.d.ts +1 -1
- package/src/highlightstack.js +1 -1
- package/src/utils.d.ts +1 -1
- package/src/utils.js +7 -3
- package/src/widget.js +4 -0
- package/src/widgetresize/resizer.d.ts +1 -1
- package/src/widgetresize/resizer.js +1 -1
- package/src/widgetresize/resizerstate.d.ts +1 -1
- package/src/widgetresize/resizerstate.js +1 -1
@@ -22,7 +22,7 @@ declare const HighlightStack_base: {
|
|
22
22
|
*
|
23
23
|
* This way, highlight will be applied with the same rules it is applied on texts.
|
24
24
|
*/
|
25
|
-
export default class HighlightStack extends HighlightStack_base {
|
25
|
+
export default class HighlightStack extends /* #__PURE__ */ HighlightStack_base {
|
26
26
|
private readonly _stack;
|
27
27
|
/**
|
28
28
|
* Adds highlight descriptor to the stack.
|
package/dist/types/utils.d.ts
CHANGED
@@ -204,7 +204,7 @@ export declare function viewToModelPositionOutsideModelElement(model: Model, vie
|
|
204
204
|
* Starting from a DOM resize host element (an element that receives dimensions as a result of resizing),
|
205
205
|
* this helper returns the width of the found ancestor element.
|
206
206
|
*
|
207
|
-
*
|
207
|
+
* * It searches up to 5 levels of ancestors only.
|
208
208
|
*
|
209
209
|
* @param domResizeHost Resize host DOM element that receives dimensions as a result of resizing.
|
210
210
|
* @returns Width of ancestor element in pixels or 0 if no ancestor with a computed width has been found.
|
@@ -16,7 +16,7 @@ declare const Resizer_base: {
|
|
16
16
|
/**
|
17
17
|
* Represents a resizer for a single resizable object.
|
18
18
|
*/
|
19
|
-
export default class Resizer extends Resizer_base {
|
19
|
+
export default class Resizer extends /* #__PURE__ */ Resizer_base {
|
20
20
|
/**
|
21
21
|
* Flag that indicates whether resizer can be used.
|
22
22
|
*
|
@@ -14,7 +14,7 @@ declare const ResizeState_base: {
|
|
14
14
|
/**
|
15
15
|
* Stores the internal state of a single resizable object.
|
16
16
|
*/
|
17
|
-
export default class ResizeState extends ResizeState_base {
|
17
|
+
export default class ResizeState extends /* #__PURE__ */ ResizeState_base {
|
18
18
|
/**
|
19
19
|
* The position of the handle that initiated the resizing. E.g. `"top-left"`, `"bottom-right"` etc. or `null`
|
20
20
|
* if unknown.
|
package/lang/contexts.json
CHANGED
@@ -7,5 +7,6 @@
|
|
7
7
|
"Insert a new paragraph directly after a widget": "Accessibility help dialog entry explaining the meaning of the keystroke that inserts a paragraph after a widget.",
|
8
8
|
"Insert a new paragraph directly before a widget": "Accessibility help dialog entry explaining the meaning of the keystroke that inserts a paragraph before a widget.",
|
9
9
|
"Move the caret to allow typing directly before a widget": "Accessibility help dialog entry explaining the meaning of the keystroke that moves the caret before a widget.",
|
10
|
-
"Move the caret to allow typing directly after a widget": "Accessibility help dialog entry explaining the meaning of the keystroke that moves the caret after a widget."
|
10
|
+
"Move the caret to allow typing directly after a widget": "Accessibility help dialog entry explaining the meaning of the keystroke that moves the caret after a widget.",
|
11
|
+
"Move focus from an editable area back to the parent widget": "Accessibility help dialog entry explaining the meaning of the keystroke that moves selection from a nested editable area back to the parent widget."
|
11
12
|
}
|
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-20240509.0",
|
4
4
|
"description": "Widget API for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,12 +12,12 @@
|
|
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-ui": "0.0.0-nightly-
|
19
|
-
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-
|
20
|
-
"@ckeditor/ckeditor5-typing": "0.0.0-nightly-
|
15
|
+
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20240509.0",
|
16
|
+
"@ckeditor/ckeditor5-engine": "0.0.0-nightly-20240509.0",
|
17
|
+
"@ckeditor/ckeditor5-enter": "0.0.0-nightly-20240509.0",
|
18
|
+
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20240509.0",
|
19
|
+
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20240509.0",
|
20
|
+
"@ckeditor/ckeditor5-typing": "0.0.0-nightly-20240509.0",
|
21
21
|
"lodash-es": "4.17.21"
|
22
22
|
},
|
23
23
|
"author": "CKSource (http://cksource.com/)",
|
package/src/highlightstack.d.ts
CHANGED
@@ -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 default class HighlightStack extends HighlightStack_base {
|
21
|
+
export default class HighlightStack extends /* #__PURE__ */ HighlightStack_base {
|
22
22
|
private readonly _stack;
|
23
23
|
/**
|
24
24
|
* Adds highlight descriptor to the stack.
|
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 default class HighlightStack extends EmitterMixin() {
|
20
|
+
export default class HighlightStack extends /* #__PURE__ */ EmitterMixin() {
|
21
21
|
constructor() {
|
22
22
|
super(...arguments);
|
23
23
|
this._stack = [];
|
package/src/utils.d.ts
CHANGED
@@ -200,7 +200,7 @@ export declare function viewToModelPositionOutsideModelElement(model: Model, vie
|
|
200
200
|
* Starting from a DOM resize host element (an element that receives dimensions as a result of resizing),
|
201
201
|
* this helper returns the width of the found ancestor element.
|
202
202
|
*
|
203
|
-
*
|
203
|
+
* * It searches up to 5 levels of ancestors only.
|
204
204
|
*
|
205
205
|
* @param domResizeHost Resize host DOM element that receives dimensions as a result of resizing.
|
206
206
|
* @returns Width of ancestor element in pixels or 0 if no ancestor with a computed width has been found.
|
package/src/utils.js
CHANGED
@@ -350,18 +350,22 @@ function addSelectionHandle(widgetElement, writer) {
|
|
350
350
|
* Starting from a DOM resize host element (an element that receives dimensions as a result of resizing),
|
351
351
|
* this helper returns the width of the found ancestor element.
|
352
352
|
*
|
353
|
-
*
|
353
|
+
* * It searches up to 5 levels of ancestors only.
|
354
354
|
*
|
355
355
|
* @param domResizeHost Resize host DOM element that receives dimensions as a result of resizing.
|
356
356
|
* @returns Width of ancestor element in pixels or 0 if no ancestor with a computed width has been found.
|
357
357
|
*/
|
358
358
|
export function calculateResizeHostAncestorWidth(domResizeHost) {
|
359
|
+
const getElementComputedWidth = (element) => {
|
360
|
+
const { width, paddingLeft, paddingRight } = element.ownerDocument.defaultView.getComputedStyle(element);
|
361
|
+
return parseFloat(width) - (parseFloat(paddingLeft) || 0) - (parseFloat(paddingRight) || 0);
|
362
|
+
};
|
359
363
|
const domResizeHostParent = domResizeHost.parentElement;
|
360
364
|
if (!domResizeHostParent) {
|
361
365
|
return 0;
|
362
366
|
}
|
363
367
|
// Need to use computed style as it properly excludes parent's paddings from the returned value.
|
364
|
-
let parentWidth =
|
368
|
+
let parentWidth = getElementComputedWidth(domResizeHostParent);
|
365
369
|
// Sometimes parent width cannot be accessed. If that happens we should go up in the elements tree
|
366
370
|
// and try to get width from next ancestor.
|
367
371
|
// https://github.com/ckeditor/ckeditor5/issues/10776
|
@@ -373,7 +377,7 @@ export function calculateResizeHostAncestorWidth(domResizeHost) {
|
|
373
377
|
if (++currentLevel > ancestorLevelLimit) {
|
374
378
|
return 0;
|
375
379
|
}
|
376
|
-
parentWidth =
|
380
|
+
parentWidth = getElementComputedWidth(checkedElement);
|
377
381
|
}
|
378
382
|
return parentWidth;
|
379
383
|
}
|
package/src/widget.js
CHANGED
@@ -186,6 +186,10 @@ export default class Widget extends Plugin {
|
|
186
186
|
id: 'widget',
|
187
187
|
label: t('Keystrokes that can be used when a widget is selected (for example: image, table, etc.)'),
|
188
188
|
keystrokes: [
|
189
|
+
{
|
190
|
+
label: t('Move focus from an editable area back to the parent widget'),
|
191
|
+
keystroke: 'Esc'
|
192
|
+
},
|
189
193
|
{
|
190
194
|
label: t('Insert a new paragraph directly after a widget'),
|
191
195
|
keystroke: 'Enter'
|
@@ -12,7 +12,7 @@ declare const Resizer_base: {
|
|
12
12
|
/**
|
13
13
|
* Represents a resizer for a single resizable object.
|
14
14
|
*/
|
15
|
-
export default class Resizer extends Resizer_base {
|
15
|
+
export default class Resizer extends /* #__PURE__ */ Resizer_base {
|
16
16
|
/**
|
17
17
|
* Flag that indicates whether resizer can be used.
|
18
18
|
*
|
@@ -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 default class Resizer extends ObservableMixin() {
|
15
|
+
export default class Resizer extends /* #__PURE__ */ ObservableMixin() {
|
16
16
|
/**
|
17
17
|
* @param options Resizer options.
|
18
18
|
*/
|
@@ -10,7 +10,7 @@ declare const ResizeState_base: {
|
|
10
10
|
/**
|
11
11
|
* Stores the internal state of a single resizable object.
|
12
12
|
*/
|
13
|
-
export default class ResizeState extends ResizeState_base {
|
13
|
+
export default class ResizeState extends /* #__PURE__ */ ResizeState_base {
|
14
14
|
/**
|
15
15
|
* The position of the handle that initiated the resizing. E.g. `"top-left"`, `"bottom-right"` etc. or `null`
|
16
16
|
* if unknown.
|
@@ -10,7 +10,7 @@ import { calculateResizeHostPercentageWidth } from '../utils.js';
|
|
10
10
|
/**
|
11
11
|
* Stores the internal state of a single resizable object.
|
12
12
|
*/
|
13
|
-
export default class ResizeState extends ObservableMixin() {
|
13
|
+
export default class ResizeState extends /* #__PURE__ */ ObservableMixin() {
|
14
14
|
/**
|
15
15
|
* @param options Resizer options.
|
16
16
|
*/
|