@ckeditor/ckeditor5-widget 43.1.0-alpha.5 → 43.1.0-alpha.7

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.5",
3
+ "version": "43.1.0-alpha.7",
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.5",
16
- "@ckeditor/ckeditor5-engine": "43.1.0-alpha.5",
17
- "@ckeditor/ckeditor5-enter": "43.1.0-alpha.5",
18
- "@ckeditor/ckeditor5-ui": "43.1.0-alpha.5",
19
- "@ckeditor/ckeditor5-utils": "43.1.0-alpha.5",
20
- "@ckeditor/ckeditor5-typing": "43.1.0-alpha.5",
15
+ "@ckeditor/ckeditor5-core": "43.1.0-alpha.7",
16
+ "@ckeditor/ckeditor5-engine": "43.1.0-alpha.7",
17
+ "@ckeditor/ckeditor5-enter": "43.1.0-alpha.7",
18
+ "@ckeditor/ckeditor5-ui": "43.1.0-alpha.7",
19
+ "@ckeditor/ckeditor5-utils": "43.1.0-alpha.7",
20
+ "@ckeditor/ckeditor5-typing": "43.1.0-alpha.7",
21
21
  "lodash-es": "4.17.21"
22
22
  },
23
23
  "author": "CKSource (http://cksource.com/)",
package/src/widget.js CHANGED
@@ -217,6 +217,10 @@ export default class Widget extends Plugin {
217
217
  const view = editor.editing.view;
218
218
  const viewDocument = view.document;
219
219
  let element = domEventData.target;
220
+ // Some of DOM elements have no view element representation so it may be null.
221
+ if (!element) {
222
+ return;
223
+ }
220
224
  // If triple click should select entire paragraph.
221
225
  if (domEventData.domEvent.detail >= 3) {
222
226
  if (this._selectBlockContent(element)) {
@@ -514,10 +518,15 @@ function findClosestEditableOrWidgetAncestor(element) {
514
518
  */
515
519
  function getElementFromMouseEvent(view, domEventData) {
516
520
  const domRange = getRangeFromMouseEvent(domEventData.domEvent);
517
- if (!domRange) {
518
- return null;
521
+ let viewRange = null;
522
+ if (domRange) {
523
+ viewRange = view.domConverter.domRangeToView(domRange);
524
+ }
525
+ else {
526
+ // Fallback to create range in target element. It happens frequently on Safari browser.
527
+ // See more: https://github.com/ckeditor/ckeditor5/issues/16978
528
+ viewRange = view.createRange(view.createPositionAt(domEventData.target, 0));
519
529
  }
520
- const viewRange = view.domConverter.domRangeToView(domRange);
521
530
  if (!viewRange) {
522
531
  return null;
523
532
  }