@ckeditor/ckeditor5-widget 43.1.0-alpha.0 → 43.1.0-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-widget",
3
- "version": "43.1.0-alpha.0",
3
+ "version": "43.1.0-alpha.2",
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": "43.1.0-alpha.0",
16
- "@ckeditor/ckeditor5-engine": "43.1.0-alpha.0",
17
- "@ckeditor/ckeditor5-enter": "43.1.0-alpha.0",
18
- "@ckeditor/ckeditor5-ui": "43.1.0-alpha.0",
19
- "@ckeditor/ckeditor5-utils": "43.1.0-alpha.0",
20
- "@ckeditor/ckeditor5-typing": "43.1.0-alpha.0",
15
+ "@ckeditor/ckeditor5-core": "43.1.0-alpha.2",
16
+ "@ckeditor/ckeditor5-engine": "43.1.0-alpha.2",
17
+ "@ckeditor/ckeditor5-enter": "43.1.0-alpha.2",
18
+ "@ckeditor/ckeditor5-ui": "43.1.0-alpha.2",
19
+ "@ckeditor/ckeditor5-utils": "43.1.0-alpha.2",
20
+ "@ckeditor/ckeditor5-typing": "43.1.0-alpha.2",
21
21
  "lodash-es": "4.17.21"
22
22
  },
23
23
  "author": "CKSource (http://cksource.com/)",
package/src/widget.js CHANGED
@@ -525,9 +525,20 @@ function getElementFromMouseEvent(view, domEventData) {
525
525
  if (!viewPosition.parent) {
526
526
  return null;
527
527
  }
528
- // Click after a widget tend to return position at the end of the editable element
529
- // so use the node before it if range is at the end of a parent.
530
- const viewNode = viewPosition.parent.is('editableElement') && viewPosition.isAtEnd && viewPosition.nodeBefore || viewPosition.parent;
528
+ let viewNode = viewPosition.parent;
529
+ if (viewPosition.parent.is('editableElement')) {
530
+ if (viewPosition.isAtEnd && viewPosition.nodeBefore) {
531
+ // Click after a widget tend to return position at the end of the editable element
532
+ // so use the node before it if range is at the end of a parent.
533
+ viewNode = viewPosition.nodeBefore;
534
+ }
535
+ else if (viewPosition.isAtStart && viewPosition.nodeAfter) {
536
+ // Click before a widget tend to return position at the start of the editable element
537
+ // so use the node after it if range is at the start of a parent.
538
+ // See more: https://github.com/ckeditor/ckeditor5/issues/16992
539
+ viewNode = viewPosition.nodeAfter;
540
+ }
541
+ }
531
542
  if (viewNode.is('$text')) {
532
543
  return viewNode.parent;
533
544
  }