@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
package/dist/index.js
CHANGED
@@ -10,7 +10,7 @@ import { IconView, Template, ContextualBalloon, ToolbarView, BalloonPanelView, V
|
|
10
10
|
import { Enter } from '@ckeditor/ckeditor5-enter/dist/index.js';
|
11
11
|
import { throttle } from 'lodash-es';
|
12
12
|
|
13
|
-
class HighlightStack extends EmitterMixin() {
|
13
|
+
class HighlightStack extends /* #__PURE__ */ EmitterMixin() {
|
14
14
|
/**
|
15
15
|
* Adds highlight descriptor to the stack.
|
16
16
|
*
|
@@ -447,17 +447,21 @@ var dragHandleIcon = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/
|
|
447
447
|
* Starting from a DOM resize host element (an element that receives dimensions as a result of resizing),
|
448
448
|
* this helper returns the width of the found ancestor element.
|
449
449
|
*
|
450
|
-
*
|
450
|
+
* * It searches up to 5 levels of ancestors only.
|
451
451
|
*
|
452
452
|
* @param domResizeHost Resize host DOM element that receives dimensions as a result of resizing.
|
453
453
|
* @returns Width of ancestor element in pixels or 0 if no ancestor with a computed width has been found.
|
454
454
|
*/ function calculateResizeHostAncestorWidth(domResizeHost) {
|
455
|
+
const getElementComputedWidth = (element)=>{
|
456
|
+
const { width, paddingLeft, paddingRight } = element.ownerDocument.defaultView.getComputedStyle(element);
|
457
|
+
return parseFloat(width) - (parseFloat(paddingLeft) || 0) - (parseFloat(paddingRight) || 0);
|
458
|
+
};
|
455
459
|
const domResizeHostParent = domResizeHost.parentElement;
|
456
460
|
if (!domResizeHostParent) {
|
457
461
|
return 0;
|
458
462
|
}
|
459
463
|
// Need to use computed style as it properly excludes parent's paddings from the returned value.
|
460
|
-
let parentWidth =
|
464
|
+
let parentWidth = getElementComputedWidth(domResizeHostParent);
|
461
465
|
// Sometimes parent width cannot be accessed. If that happens we should go up in the elements tree
|
462
466
|
// and try to get width from next ancestor.
|
463
467
|
// https://github.com/ckeditor/ckeditor5/issues/10776
|
@@ -469,7 +473,7 @@ var dragHandleIcon = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/
|
|
469
473
|
if (++currentLevel > ancestorLevelLimit) {
|
470
474
|
return 0;
|
471
475
|
}
|
472
|
-
parentWidth =
|
476
|
+
parentWidth = getElementComputedWidth(checkedElement);
|
473
477
|
}
|
474
478
|
return parentWidth;
|
475
479
|
}
|
@@ -1619,6 +1623,10 @@ class Widget extends Plugin {
|
|
1619
1623
|
id: 'widget',
|
1620
1624
|
label: t('Keystrokes that can be used when a widget is selected (for example: image, table, etc.)'),
|
1621
1625
|
keystrokes: [
|
1626
|
+
{
|
1627
|
+
label: t('Move focus from an editable area back to the parent widget'),
|
1628
|
+
keystroke: 'Esc'
|
1629
|
+
},
|
1622
1630
|
{
|
1623
1631
|
label: t('Insert a new paragraph directly after a widget'),
|
1624
1632
|
keystroke: 'Enter'
|
@@ -2203,7 +2211,7 @@ function isWidgetSelected(selection) {
|
|
2203
2211
|
return !!(viewElement && isWidget(viewElement));
|
2204
2212
|
}
|
2205
2213
|
|
2206
|
-
class ResizeState extends ObservableMixin() {
|
2214
|
+
class ResizeState extends /* #__PURE__ */ ObservableMixin() {
|
2207
2215
|
/**
|
2208
2216
|
* The original width (pixels) of the resized object when the resize process was started.
|
2209
2217
|
*/ get originalWidth() {
|
@@ -2366,7 +2374,7 @@ class SizeView extends View {
|
|
2366
2374
|
}
|
2367
2375
|
}
|
2368
2376
|
|
2369
|
-
class Resizer extends ObservableMixin() {
|
2377
|
+
class Resizer extends /* #__PURE__ */ ObservableMixin() {
|
2370
2378
|
/**
|
2371
2379
|
* Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.
|
2372
2380
|
*
|