@cocreate/cursors 1.11.3 → 1.11.7

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.7](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.6...v1.11.7) (2022-01-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * commented parentElement.style postion:relative and display:inline ([b2123b6](https://github.com/CoCreate-app/CoCreate-cursors/commit/b2123b6ffe9e197f2f071b36c1c3419d9db71619))
7
+
8
+ ## [1.11.6](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.5...v1.11.6) (2022-01-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * removed commented code ([6eabd19](https://github.com/CoCreate-app/CoCreate-cursors/commit/6eabd1955963b44ba6db6259f0a492ddfe2cd54a))
14
+
15
+ ## [1.11.5](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.4...v1.11.5) (2022-01-11)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * if parent position is static add relative to contain cursor-container ([76f23c1](https://github.com/CoCreate-app/CoCreate-cursors/commit/76f23c1520fdc270f325885332ccf67bab6787ed))
21
+
22
+ ## [1.11.4](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.3...v1.11.4) (2022-01-01)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * 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))
28
+
1
29
  ## [1.11.3](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.2...v1.11.3) (2021-12-23)
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.3",
3
+ "version": "1.11.7",
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
@@ -98,6 +98,15 @@ function drawCursors(selection) {
98
98
  mirrorDiv.contentEditable = false;
99
99
  mirrorDiv.element = element;
100
100
  element.insertAdjacentElement('afterend', mirrorDiv);
101
+ // let parent = element.parentElement;
102
+ // let parentComputed = getComputedStyle(parent);
103
+ // let parentStylePosition = parentComputed['position'];
104
+ // if (parentStylePosition == 'static')
105
+ // parent.style.position = 'relative';
106
+ // let parentStyleDisplay = parentComputed['display'];
107
+ // if (parentStyleDisplay == 'inline')
108
+ // parent.style.display = 'inline';
109
+
101
110
  _initEvents(element);
102
111
  initDocument(document);
103
112
  }
@@ -111,10 +120,8 @@ function drawCursors(selection) {
111
120
  if (element.clientWidth != 0)
112
121
  scrollBarWidth = element.offsetWidth - element.clientWidth - borderWidth;
113
122
  let style = mirrorDiv.style;
114
-
123
+
115
124
  style.position = 'absolute';
116
- style.top = element.offsetTop + 'px';
117
- style.left = element.offsetLeft + 'px';
118
125
  style.width = rect.width + 'px';
119
126
  style.height = rect.height + 'px';
120
127
  style.visibility = 'visible';
@@ -124,7 +131,16 @@ function drawCursors(selection) {
124
131
  style.paddingRight = parseInt(computed['paddingRight']) + scrollBarWidth + 'px';
125
132
  style.border = computed['border'];
126
133
  style.borderColor = 'transparent';
127
-
134
+
135
+ if (element.parentElement.style['display'] == 'inline') {
136
+ style.top = element.clientTop + 'px';
137
+ style.left = element.clientLeft + 'px';
138
+ }
139
+ else {
140
+ style.top = element.offsetTop + 'px';
141
+ style.left = element.offsetLeft + 'px';
142
+ }
143
+
128
144
  if (element.nodeName !== 'INPUT') {
129
145
  style.wordWrap = 'break-word';
130
146
  style.whiteSpace = 'pre-wrap';