@cocreate/cursors 1.11.1 → 1.11.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/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [1.11.5](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.4...v1.11.5) (2022-01-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * if parent position is static add relative to contain cursor-container ([76f23c1](https://github.com/CoCreate-app/CoCreate-cursors/commit/76f23c1520fdc270f325885332ccf67bab6787ed))
7
+
8
+ ## [1.11.4](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.3...v1.11.4) (2022-01-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * 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))
14
+
15
+ ## [1.11.3](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.2...v1.11.3) (2021-12-23)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * if elementActive and clientId is self return ([170ee7a](https://github.com/CoCreate-app/CoCreate-cursors/commit/170ee7a233f32e4fda9010e1ae18b9328489c6ed))
21
+
22
+ ## [1.11.2](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.1...v1.11.2) (2021-12-19)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * if pos.start and if pos.path case ([fdf7372](https://github.com/CoCreate-app/CoCreate-cursors/commit/fdf7372a59963548c421edfb080184de61e60e00))
28
+
1
29
  ## [1.11.1](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.0...v1.11.1) (2021-12-15)
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.1",
3
+ "version": "1.11.5",
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.40",
66
- "@cocreate/docs": "^1.2.62",
67
- "@cocreate/message-client": "^1.1.58",
68
- "@cocreate/observer": "^1.3.54",
69
- "@cocreate/random-color": "^1.2.15",
70
- "@cocreate/selection": "^1.3.1",
71
- "@cocreate/uuid": "^1.1.51"
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;
@@ -95,6 +98,13 @@ function drawCursors(selection) {
95
98
  mirrorDiv.contentEditable = false;
96
99
  mirrorDiv.element = element;
97
100
  element.insertAdjacentElement('afterend', mirrorDiv);
101
+ let parent = element.parentElement;
102
+ let parentComputed = getComputedStyle(parent);
103
+ // let parentStylePosition = parent.style.position;
104
+ let parentStylePosition = parentComputed['position'];
105
+ if (parentStylePosition == 'static')
106
+ parent.style.position = 'relative';
107
+
98
108
  _initEvents(element);
99
109
  initDocument(document);
100
110
  }
@@ -310,6 +320,7 @@ function sendPosition(info) {
310
320
 
311
321
 
312
322
  message.listen('cursor', function(selection) {
323
+ // if (selection.clientId == clientId) return;
313
324
  if (selection.start != null && selection.end != null)
314
325
  drawCursors(selection);
315
326
  else