@cocreate/cursors 1.11.0 → 1.11.4

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,31 @@
1
+ ## [1.11.4](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.3...v1.11.4) (2022-01-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * get-value attribute value now supports a selector added # to all values currently in get-value attributes ([cd5d366](https://github.com/CoCreate-app/CoCreate-cursors/commit/cd5d366fee456b703644b5871654519c3cdd0750))
7
+
8
+ ## [1.11.3](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.2...v1.11.3) (2021-12-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * if elementActive and clientId is self return ([170ee7a](https://github.com/CoCreate-app/CoCreate-cursors/commit/170ee7a233f32e4fda9010e1ae18b9328489c6ed))
14
+
15
+ ## [1.11.2](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.1...v1.11.2) (2021-12-19)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * if pos.start and if pos.path case ([fdf7372](https://github.com/CoCreate-app/CoCreate-cursors/commit/fdf7372a59963548c421edfb080184de61e60e00))
21
+
22
+ ## [1.11.1](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.0...v1.11.1) (2021-12-15)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update dependencies ([186f745](https://github.com/CoCreate-app/CoCreate-cursors/commit/186f74551897f424450a5b3e31df2769d030bf01))
28
+
1
29
  # [1.11.0](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.10.18...v1.11.0) (2021-12-14)
2
30
 
3
31
 
package/docs/index.html CHANGED
@@ -93,7 +93,7 @@
93
93
  <div class="svSplitter svHorizontal"> </div>
94
94
 
95
95
  <div class="svPanel">
96
- <iframe get-value="demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
96
+ <iframe get-value="#demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
97
97
  </div>
98
98
 
99
99
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cursors",
3
- "version": "1.11.0",
3
+ "version": "1.11.4",
4
4
  "description": "Collaborative user cursor position for inputs, textarea's and contenteditable elements.",
5
5
  "keywords": [
6
6
  "cursors",
@@ -62,12 +62,12 @@
62
62
  "webpack-log": "^3.0.1"
63
63
  },
64
64
  "dependencies": {
65
- "@cocreate/crud-client": "^1.4.39",
66
- "@cocreate/docs": "^1.2.61",
67
- "@cocreate/message-client": "^1.1.57",
68
- "@cocreate/observer": "^1.3.53",
69
- "@cocreate/random-color": "^1.2.14",
70
- "@cocreate/selection": "^1.3.0",
71
- "@cocreate/uuid": "^1.1.50"
65
+ "@cocreate/crud-client": "^1.4.41",
66
+ "@cocreate/docs": "^1.2.63",
67
+ "@cocreate/message-client": "^1.1.59",
68
+ "@cocreate/observer": "^1.3.55",
69
+ "@cocreate/random-color": "^1.2.16",
70
+ "@cocreate/selection": "^1.3.2",
71
+ "@cocreate/uuid": "^1.1.52"
72
72
  }
73
73
  }
package/src/index.js CHANGED
@@ -58,8 +58,8 @@ function drawCursors(selection) {
58
58
  elements = document.querySelectorAll(selector);
59
59
  }
60
60
  for (let element of elements) {
61
- if (element.activeElement) {
62
- element.activeElement = '';
61
+ if (element.activeElement && selection.clientId == clientId) {
62
+ // element.activeElement = '';
63
63
  continue;
64
64
  }
65
65
  let realtime = element.getAttribute('realtime');
@@ -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