@ckeditor/ckeditor5-widget 0.0.0-nightly-20251014.0 → 0.0.0-nightly-20251015.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-20251014.0",
3
+ "version": "0.0.0-nightly-20251015.0",
4
4
  "description": "Widget API for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,13 +12,13 @@
12
12
  "type": "module",
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-core": "0.0.0-nightly-20251014.0",
16
- "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20251014.0",
17
- "@ckeditor/ckeditor5-enter": "0.0.0-nightly-20251014.0",
18
- "@ckeditor/ckeditor5-icons": "0.0.0-nightly-20251014.0",
19
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20251014.0",
20
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20251014.0",
21
- "@ckeditor/ckeditor5-typing": "0.0.0-nightly-20251014.0",
15
+ "@ckeditor/ckeditor5-core": "0.0.0-nightly-20251015.0",
16
+ "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20251015.0",
17
+ "@ckeditor/ckeditor5-enter": "0.0.0-nightly-20251015.0",
18
+ "@ckeditor/ckeditor5-icons": "0.0.0-nightly-20251015.0",
19
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20251015.0",
20
+ "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20251015.0",
21
+ "@ckeditor/ckeditor5-typing": "0.0.0-nightly-20251015.0",
22
22
  "es-toolkit": "1.39.5"
23
23
  },
24
24
  "author": "CKSource (http://cksource.com/)",
package/src/widget.js CHANGED
@@ -171,7 +171,10 @@ export class Widget extends Plugin {
171
171
  data.preventDefault();
172
172
  evt.stop();
173
173
  }
174
- }, { priority: 'low' });
174
+ }, {
175
+ context: node => node.is('editableElement'),
176
+ priority: 'low'
177
+ });
175
178
  // Add the information about the keystrokes to the accessibility database.
176
179
  editor.accessibility.addKeystrokeInfoGroup({
177
180
  id: 'widget',
@@ -504,12 +507,8 @@ export class Widget extends Plugin {
504
507
  view.createRange(view.createPositionAt(startPosition.root, 0), startPosition);
505
508
  for (const { nextPosition } of viewRange.getWalker({ direction })) {
506
509
  const item = nextPosition.parent;
507
- // Ignore currently selected editable or widget.
508
- if (item == editableElement || item == selectedElement) {
509
- continue;
510
- }
511
- // Some widget along the way.
512
- if (isWidget(item)) {
510
+ // Some widget along the way except the currently selected one.
511
+ if (isWidget(item) && item != selectedElement) {
513
512
  const modelElement = editing.mapper.toModelElement(item);
514
513
  // Do not select inline widgets.
515
514
  if (!model.schema.isBlock(modelElement)) {
@@ -522,16 +521,26 @@ export class Widget extends Plugin {
522
521
  }
523
522
  // Encountered an editable element.
524
523
  else if (item.is('editableElement')) {
524
+ // Ignore the current editable for text selection,
525
+ // but use it when widget was selected to be able to jump after the widget.
526
+ if (item == editableElement && !selectedElement) {
527
+ continue;
528
+ }
525
529
  const modelPosition = editing.mapper.toModelPosition(nextPosition);
526
- let newRange = model.schema.getNearestSelectionRange(modelPosition, direction);
530
+ const newRange = model.schema.getNearestSelectionRange(modelPosition, direction);
527
531
  // There is nothing to select so just jump to the next one.
528
532
  if (!newRange) {
529
533
  continue;
530
534
  }
535
+ // In the same editable while widget was selected - do not select the editable content.
536
+ if (item == editableElement && selectedElement) {
537
+ return newRange;
538
+ }
531
539
  // Select the content of editable element when iterating over sibling editable elements
532
540
  // or going deeper into nested widgets.
533
541
  if (compareArrays(editablePath, item.getPath()) != 'extension') {
534
- newRange = model.createRangeIn(modelPosition.parent);
542
+ // Find a limit element closest to the new selection range.
543
+ return model.createRangeIn(model.schema.getLimitElement(newRange));
535
544
  }
536
545
  return newRange;
537
546
  }