@livingdocs/editable.js 3.0.10 → 3.0.11

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@livingdocs/editable.js",
3
3
  "description": "Friendly contenteditable API",
4
- "version": "3.0.10",
4
+ "version": "3.0.11",
5
5
  "dependencies": {
6
6
  "@babel/runtime": "^7.13.17",
7
7
  "bowser": "2.11.0",
@@ -83,11 +83,11 @@
83
83
  "isCi": true,
84
84
  "name": "Drone",
85
85
  "service": "drone",
86
- "commit": "ba2101da4792e70d5ee82e2d4fb0fb2e3879002a",
87
- "build": "412",
86
+ "commit": "d8207571aa6ea4a4bfcbd7f5755a95c907df53ef",
87
+ "build": "416",
88
88
  "branch": "master",
89
89
  "isPr": false,
90
90
  "slug": "livingdocsIO/editable.js",
91
- "date": "2021-12-29T08:41:38.566Z"
91
+ "date": "2021-12-29T16:06:04.948Z"
92
92
  }
93
93
  }
@@ -19,13 +19,15 @@ function isChildOf (parent, possibleChild) {
19
19
  }
20
20
 
21
21
  function startContainerIsChild (range) {
22
- const parent = range.endContainer.parentElement
22
+ const parent = range.commonAncestorContainer
23
+ if (parent.nodeType === 3) return false // if we are on the text node it can't be a parent
23
24
  const possibleChild = range.startContainer.parentElement
24
25
  return isChildOf(parent, possibleChild)
25
26
  }
26
27
 
27
28
  function endContainerIsChild (range) {
28
- const parent = range.startContainer.parentElement
29
+ const parent = range.commonAncestorContainer
30
+ if (parent.nodeType === 3) return false // if we are on the text node it can't be a parent
29
31
  const possibleChild = range.endContainer.parentElement
30
32
  return isChildOf(parent, possibleChild)
31
33
  }