@cocreate/cursors 1.11.6 → 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 +7 -0
- package/package.json +1 -1
- package/src/index.js +19 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
|
|
1
8
|
## [1.11.6](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.5...v1.11.6) (2022-01-11)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -98,11 +98,14 @@ 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
|
-
|
|
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';
|
|
106
109
|
|
|
107
110
|
_initEvents(element);
|
|
108
111
|
initDocument(document);
|
|
@@ -117,10 +120,8 @@ function drawCursors(selection) {
|
|
|
117
120
|
if (element.clientWidth != 0)
|
|
118
121
|
scrollBarWidth = element.offsetWidth - element.clientWidth - borderWidth;
|
|
119
122
|
let style = mirrorDiv.style;
|
|
120
|
-
|
|
123
|
+
|
|
121
124
|
style.position = 'absolute';
|
|
122
|
-
style.top = element.offsetTop + 'px';
|
|
123
|
-
style.left = element.offsetLeft + 'px';
|
|
124
125
|
style.width = rect.width + 'px';
|
|
125
126
|
style.height = rect.height + 'px';
|
|
126
127
|
style.visibility = 'visible';
|
|
@@ -130,7 +131,16 @@ function drawCursors(selection) {
|
|
|
130
131
|
style.paddingRight = parseInt(computed['paddingRight']) + scrollBarWidth + 'px';
|
|
131
132
|
style.border = computed['border'];
|
|
132
133
|
style.borderColor = 'transparent';
|
|
133
|
-
|
|
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
|
+
|
|
134
144
|
if (element.nodeName !== 'INPUT') {
|
|
135
145
|
style.wordWrap = 'break-word';
|
|
136
146
|
style.whiteSpace = 'pre-wrap';
|