@cocreate/cursors 1.11.1 → 1.11.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.11.2](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.1...v1.11.2) (2021-12-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * if pos.start and if pos.path case ([fdf7372](https://github.com/CoCreate-app/CoCreate-cursors/commit/fdf7372a59963548c421edfb080184de61e60e00))
7
+
1
8
  ## [1.11.1](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.0...v1.11.1) (2021-12-15)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cursors",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "description": "Collaborative user cursor position for inputs, textarea's and contenteditable elements.",
5
5
  "keywords": [
6
6
  "cursors",
package/src/index.js CHANGED
@@ -73,13 +73,16 @@ function drawCursors(selection) {
73
73
  domTextEditor = element.contentDocument.documentElement;
74
74
  }
75
75
  let pos = getElementPosition(domTextEditor.htmlString, start, end);
76
- element = domTextEditor.querySelector(pos.path);
77
- let endPos = end - start;
78
- if (endPos > 0)
79
- end = pos.start + endPos;
80
- else
81
- end = pos.start;
82
- start = pos.start;
76
+ if (pos.start){
77
+ if(pos.path)
78
+ element = domTextEditor.querySelector(pos.path);
79
+ let endPos = end - start;
80
+ if (endPos > 0)
81
+ end = pos.start + endPos;
82
+ else
83
+ end = pos.start;
84
+ start = pos.start;
85
+ }
83
86
  }
84
87
  if(!element) continue;
85
88
  let document = element.ownerDocument;
@@ -310,6 +313,7 @@ function sendPosition(info) {
310
313
 
311
314
 
312
315
  message.listen('cursor', function(selection) {
316
+ // if (selection.clientId == clientId) return;
313
317
  if (selection.start != null && selection.end != null)
314
318
  drawCursors(selection);
315
319
  else