@ckeditor/ckeditor5-widget 0.0.0-nightly-20250901.0 → 0.0.0-nightly-20250903.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 CHANGED
@@ -3,7 +3,7 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
5
  import { Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
6
- import { MouseObserver, ModelTreeWalker } from '@ckeditor/ckeditor5-engine/dist/index.js';
6
+ import { MouseObserver, PointerObserver, ModelTreeWalker } from '@ckeditor/ckeditor5-engine/dist/index.js';
7
7
  import { Delete } from '@ckeditor/ckeditor5-typing/dist/index.js';
8
8
  import { EmitterMixin, Rect, CKEditorError, toArray, isForwardArrowKeyCode, env, keyCodes, getLocalizedArrowKeyCodeDirection, getRangeFromMouseEvent, logWarning, ObservableMixin, compareArrays, global, DomEmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';
9
9
  import { IconDragHandle, IconReturnArrow } from '@ckeditor/ckeditor5-icons/dist/index.js';
@@ -1597,7 +1597,9 @@ function selectionWillShrink(selection, isForward) {
1597
1597
  });
1598
1598
  // If mouse down is pressed on widget - create selection over whole widget.
1599
1599
  view.addObserver(MouseObserver);
1600
+ view.addObserver(PointerObserver);
1600
1601
  this.listenTo(viewDocument, 'mousedown', (...args)=>this._onMousedown(...args));
1602
+ this.listenTo(viewDocument, 'pointerdown', (...args)=>this._onPointerdown(...args));
1601
1603
  // There are two keydown listeners working on different priorities. This allows other
1602
1604
  // features such as WidgetTypeAround or TableKeyboard to attach their listeners in between
1603
1605
  // and customize the behavior even further in different content/selection scenarios.
@@ -1721,10 +1723,7 @@ function selectionWillShrink(selection, isForward) {
1721
1723
  /**
1722
1724
  * Handles {@link module:engine/view/document~ViewDocument#event:mousedown mousedown} events on widget elements.
1723
1725
  */ _onMousedown(eventInfo, domEventData) {
1724
- const editor = this.editor;
1725
- const view = editor.editing.view;
1726
- const viewDocument = view.document;
1727
- let element = domEventData.target;
1726
+ const element = domEventData.target;
1728
1727
  // Some of DOM elements have no view element representation so it may be null.
1729
1728
  if (!element) {
1730
1729
  return;
@@ -1734,6 +1733,20 @@ function selectionWillShrink(selection, isForward) {
1734
1733
  if (this._selectBlockContent(element)) {
1735
1734
  domEventData.preventDefault();
1736
1735
  }
1736
+ }
1737
+ }
1738
+ /**
1739
+ * Handles {@link module:engine/view/document~ViewDocument#event:pointerdown pointerdown} events on widget elements.
1740
+ */ _onPointerdown(eventInfo, domEventData) {
1741
+ if (!domEventData.domEvent.isPrimary) {
1742
+ return;
1743
+ }
1744
+ const editor = this.editor;
1745
+ const view = editor.editing.view;
1746
+ const viewDocument = view.document;
1747
+ let element = domEventData.target;
1748
+ // Some of DOM elements have no view element representation so it may be null.
1749
+ if (!element) {
1737
1750
  return;
1738
1751
  }
1739
1752
  // If target is not a widget element - check if one of the ancestors is.
@@ -1754,9 +1767,10 @@ function selectionWillShrink(selection, isForward) {
1754
1767
  }
1755
1768
  }
1756
1769
  }
1757
- // On Android selection would jump to the first table cell, on other devices
1770
+ // On Android and iOS selection would jump to the first table cell, on other devices
1758
1771
  // we can't block it (and don't need to) because of drag and drop support.
1759
- if (env.isAndroid) {
1772
+ // In iOS drag and drop works anyway on a long press.
1773
+ if (env.isAndroid || env.isiOS) {
1760
1774
  domEventData.preventDefault();
1761
1775
  }
1762
1776
  // Focus editor if is not focused already.