@livingdocs/editable.js 3.1.3 → 3.1.5

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.1.3",
4
+ "version": "3.1.5",
5
5
  "dependencies": {
6
6
  "@babel/runtime": "^7.16.7",
7
7
  "bowser": "2.11.0",
@@ -83,11 +83,11 @@
83
83
  "isCi": true,
84
84
  "name": "Drone",
85
85
  "service": "drone",
86
- "commit": "e1b2285d9dc4dd070a0151dbbb4af3f14b97e39b",
87
- "build": "515",
86
+ "commit": "c8989fbc0442b73af86b49685c573b875f0c3741",
87
+ "build": "643",
88
88
  "branch": "master",
89
89
  "isPr": false,
90
90
  "slug": "livingdocsIO/editable.js",
91
- "date": "2022-08-09T11:28:27.271Z"
91
+ "date": "2023-01-15T16:06:18.573Z"
92
92
  }
93
93
  }
@@ -35,6 +35,13 @@ export default function createDefaultBehavior (editable) {
35
35
  },
36
36
 
37
37
  blur (element) {
38
+ // Note: there is a special case when the tab is changed where
39
+ // we can get a blur event even if the cursor is still in the editable.
40
+ // This blur would cause us to loose the cursor position (cause of cleanInternals()).
41
+ // To prevent this we check if the activeElement is still the editable.
42
+ // (Note: document.getSelection() did not work reliably in this case.)
43
+ if (document.activeElement === element) return
44
+
38
45
  content.cleanInternals(element)
39
46
  },
40
47