@ckeditor/ckeditor5-widget 0.0.0-nightly-20250224.0 → 0.0.0-nightly-next-20250224.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-widget",
3
- "version": "0.0.0-nightly-20250224.0",
3
+ "version": "0.0.0-nightly-next-20250224.0",
4
4
  "description": "Widget API for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,13 +12,14 @@
12
12
  "type": "module",
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-core": "0.0.0-nightly-20250224.0",
16
- "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250224.0",
17
- "@ckeditor/ckeditor5-enter": "0.0.0-nightly-20250224.0",
18
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250224.0",
19
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250224.0",
20
- "@ckeditor/ckeditor5-typing": "0.0.0-nightly-20250224.0",
21
- "lodash-es": "4.17.21"
15
+ "@ckeditor/ckeditor5-core": "0.0.0-nightly-next-20250224.0",
16
+ "@ckeditor/ckeditor5-engine": "0.0.0-nightly-next-20250224.0",
17
+ "@ckeditor/ckeditor5-enter": "0.0.0-nightly-next-20250224.0",
18
+ "@ckeditor/ckeditor5-icons": "0.0.0-nightly-next-20250224.0",
19
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-next-20250224.0",
20
+ "@ckeditor/ckeditor5-utils": "0.0.0-nightly-next-20250224.0",
21
+ "@ckeditor/ckeditor5-typing": "0.0.0-nightly-next-20250224.0",
22
+ "es-toolkit": "1.32.0"
22
23
  },
23
24
  "author": "CKSource (http://cksource.com/)",
24
25
  "license": "SEE LICENSE IN LICENSE.md",
@@ -18,10 +18,7 @@ import { EmitterMixin } from '@ckeditor/ckeditor5-utils';
18
18
  * This way, highlight will be applied with the same rules it is applied on texts.
19
19
  */
20
20
  export default class HighlightStack extends /* #__PURE__ */ EmitterMixin() {
21
- constructor() {
22
- super(...arguments);
23
- this._stack = [];
24
- }
21
+ _stack = [];
25
22
  /**
26
23
  * Adds highlight descriptor to the stack.
27
24
  *
package/src/utils.d.ts CHANGED
@@ -2,9 +2,6 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
- /**
6
- * @module widget/utils
7
- */
8
5
  import { Rect, type GetCallback } from '@ckeditor/ckeditor5-utils';
9
6
  import { type HighlightDescriptor, type MapperViewToModelPositionEvent, type DocumentSelection, type DowncastWriter, type Model, type Range, type Selection, type ViewEditableElement, type ViewElement, type ViewTypeCheckable } from '@ckeditor/ckeditor5-engine';
10
7
  /**
package/src/utils.js CHANGED
@@ -5,11 +5,11 @@
5
5
  /**
6
6
  * @module widget/utils
7
7
  */
8
+ import { IconDragHandle } from '@ckeditor/ckeditor5-icons';
8
9
  import { Rect, CKEditorError, toArray } from '@ckeditor/ckeditor5-utils';
9
10
  import { IconView } from '@ckeditor/ckeditor5-ui';
10
11
  import HighlightStack from './highlightstack.js';
11
12
  import { getTypeAroundFakeCaretPosition } from './widgettypearound/utils.js';
12
- import dragHandleIcon from '../theme/icons/drag-handle.svg';
13
13
  /**
14
14
  * CSS class added to each widget element.
15
15
  */
@@ -336,7 +336,7 @@ function addSelectionHandle(widgetElement, writer) {
336
336
  const domElement = this.toDomElement(domDocument);
337
337
  // Use the IconView from the ui library.
338
338
  const icon = new IconView();
339
- icon.set('content', dragHandleIcon);
339
+ icon.set('content', IconDragHandle);
340
340
  // Render the icon view right away to append its #element to the selectionHandle DOM element.
341
341
  icon.render();
342
342
  domElement.appendChild(icon.element);
package/src/widget.js CHANGED
@@ -27,13 +27,10 @@ import '../theme/widget.css';
27
27
  * * The mouse and keyboard events handling on and around widget elements.
28
28
  */
29
29
  export default class Widget extends Plugin {
30
- constructor() {
31
- super(...arguments);
32
- /**
33
- * Holds previously selected widgets.
34
- */
35
- this._previouslySelected = new Set();
36
- }
30
+ /**
31
+ * Holds previously selected widgets.
32
+ */
33
+ _previouslySelected = new Set();
37
34
  /**
38
35
  * @inheritDoc
39
36
  */
@@ -13,15 +13,33 @@ import SizeView from './sizeview.js';
13
13
  * Represents a resizer for a single resizable object.
14
14
  */
15
15
  export default class Resizer extends /* #__PURE__ */ ObservableMixin() {
16
+ /**
17
+ * Stores the state of the resizable host geometry, such as the original width, the currently proposed height, etc.
18
+ *
19
+ * Note that a new state is created for each resize transaction.
20
+ */
21
+ _state;
22
+ /**
23
+ * A view displaying the proposed new element size during the resizing.
24
+ */
25
+ _sizeView;
26
+ /**
27
+ * Options passed to the {@link #constructor}.
28
+ */
29
+ _options;
30
+ /**
31
+ * A wrapper that is controlled by the resizer. This is usually a widget element.
32
+ */
33
+ _viewResizerWrapper = null;
34
+ /**
35
+ * The width of the resized {@link module:widget/widgetresize~ResizerOptions#viewElement viewElement} before the resizing started.
36
+ */
37
+ _initialViewWidth;
16
38
  /**
17
39
  * @param options Resizer options.
18
40
  */
19
41
  constructor(options) {
20
42
  super();
21
- /**
22
- * A wrapper that is controlled by the resizer. This is usually a widget element.
23
- */
24
- this._viewResizerWrapper = null;
25
43
  this._options = options;
26
44
  this.set('isEnabled', true);
27
45
  this.set('isSelected', false);
@@ -11,6 +11,42 @@ import { calculateResizeHostPercentageWidth } from '../utils.js';
11
11
  * Stores the internal state of a single resizable object.
12
12
  */
13
13
  export default class ResizeState extends /* #__PURE__ */ ObservableMixin() {
14
+ /**
15
+ * The reference point of the resizer where the dragging started. It is used to measure the distance the user cursor
16
+ * traveled, so how much the image should be enlarged.
17
+ * This information is only known after the DOM was rendered, so it will be updated later.
18
+ *
19
+ * @internal
20
+ */
21
+ _referenceCoordinates;
22
+ /**
23
+ * Resizer options.
24
+ */
25
+ _options;
26
+ /**
27
+ * The original width (pixels) of the resized object when the resize process was started.
28
+ *
29
+ * @readonly
30
+ */
31
+ _originalWidth;
32
+ /**
33
+ * The original height (pixels) of the resized object when the resize process was started.
34
+ *
35
+ * @readonly
36
+ */
37
+ _originalHeight;
38
+ /**
39
+ * The original width (percents) of the resized object when the resize process was started.
40
+ *
41
+ * @readonly
42
+ */
43
+ _originalWidthPercents;
44
+ /**
45
+ * A width to height ratio of the resized image.
46
+ *
47
+ * @readonly
48
+ */
49
+ _aspectRatio;
14
50
  /**
15
51
  * @param options Resizer options.
16
52
  */
@@ -9,7 +9,7 @@ import Resizer from './widgetresize/resizer.js';
9
9
  import { Plugin } from '@ckeditor/ckeditor5-core';
10
10
  import { MouseObserver } from '@ckeditor/ckeditor5-engine';
11
11
  import { DomEmitterMixin, global } from '@ckeditor/ckeditor5-utils';
12
- import { throttle } from 'lodash-es';
12
+ import { throttle } from 'es-toolkit/compat';
13
13
  import '../theme/widgetresize.css';
14
14
  /**
15
15
  * The widget resize feature plugin.
@@ -17,13 +17,12 @@ import '../theme/widgetresize.css';
17
17
  * Use the {@link module:widget/widgetresize~WidgetResize#attachTo} method to create a resizer for the specified widget.
18
18
  */
19
19
  export default class WidgetResize extends Plugin {
20
- constructor() {
21
- super(...arguments);
22
- /**
23
- * A map of resizers created using this plugin instance.
24
- */
25
- this._resizers = new Map();
26
- }
20
+ /**
21
+ * A map of resizers created using this plugin instance.
22
+ */
23
+ _resizers = new Map();
24
+ _observer;
25
+ _redrawSelectedResizerThrottled;
27
26
  /**
28
27
  * @inheritDoc
29
28
  */
@@ -36,13 +36,11 @@ import { isWidget } from './utils.js';
36
36
  * ```
37
37
  */
38
38
  export default class WidgetToolbarRepository extends Plugin {
39
- constructor() {
40
- super(...arguments);
41
- /**
42
- * A map of toolbar definitions.
43
- */
44
- this._toolbarDefinitions = new Map();
45
- }
39
+ /**
40
+ * A map of toolbar definitions.
41
+ */
42
+ _toolbarDefinitions = new Map();
43
+ _balloon;
46
44
  /**
47
45
  * @inheritDoc
48
46
  */
@@ -7,17 +7,17 @@
7
7
  * @module widget/widgettypearound/widgettypearound
8
8
  */
9
9
  import { Plugin } from '@ckeditor/ckeditor5-core';
10
+ import { IconReturnArrow } from '@ckeditor/ckeditor5-icons';
10
11
  import { Template } from '@ckeditor/ckeditor5-ui';
11
12
  import { Enter } from '@ckeditor/ckeditor5-enter';
12
13
  import { Delete } from '@ckeditor/ckeditor5-typing';
13
14
  import { env, isForwardArrowKeyCode } from '@ckeditor/ckeditor5-utils';
14
15
  import { isTypeAroundWidget, getClosestTypeAroundDomButton, getTypeAroundButtonPosition, getClosestWidgetViewElement, getTypeAroundFakeCaretPosition, TYPE_AROUND_SELECTION_ATTRIBUTE } from './utils.js';
15
16
  import { isWidget } from '../utils.js';
16
- import returnIcon from '../../theme/icons/return-arrow.svg';
17
17
  import '../../theme/widgettypearound.css';
18
18
  const POSSIBLE_INSERTION_POSITIONS = ['before', 'after'];
19
19
  // Do the SVG parsing once and then clone the result <svg> DOM element for each new button.
20
- const RETURN_ARROW_ICON_ELEMENT = new DOMParser().parseFromString(returnIcon, 'image/svg+xml').firstChild;
20
+ const RETURN_ARROW_ICON_ELEMENT = new DOMParser().parseFromString(IconReturnArrow, 'image/svg+xml').firstChild;
21
21
  const PLUGIN_DISABLED_EDITING_ROOT_CLASS = 'ck-widget__type-around_disabled';
22
22
  /**
23
23
  * A plugin that allows users to type around widgets where normally it is impossible to place the caret due
@@ -30,15 +30,12 @@ const PLUGIN_DISABLED_EDITING_ROOT_CLASS = 'ck-widget__type-around_disabled';
30
30
  * in it so that users can type (or insert content, paste, etc.) straight away.
31
31
  */
32
32
  export default class WidgetTypeAround extends Plugin {
33
- constructor() {
34
- super(...arguments);
35
- /**
36
- * A reference to the model widget element that has the fake caret active
37
- * on either side of it. It is later used to remove CSS classes associated with the fake caret
38
- * when the widget no longer needs it.
39
- */
40
- this._currentFakeCaretModelElement = null;
41
- }
33
+ /**
34
+ * A reference to the model widget element that has the fake caret active
35
+ * on either side of it. It is later used to remove CSS classes associated with the fake caret
36
+ * when the widget no longer needs it.
37
+ */
38
+ _currentFakeCaretModelElement = null;
42
39
  /**
43
40
  * @inheritDoc
44
41
  */
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>