@cocreate/cursors 1.12.22 → 1.13.0
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 +14 -0
- package/package.json +2 -1
- package/src/index.js +11 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.13.0](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.12.23...v1.13.0) (2022-12-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* improved cursor mirror accuracy ([184e1f4](https://github.com/CoCreate-app/CoCreate-cursors/commit/184e1f452dfc23cadd642e415f2d6b7397031a7e))
|
|
7
|
+
|
|
8
|
+
## [1.12.23](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.12.22...v1.12.23) (2022-12-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add missing dev dependency style-loader ([ece7b2c](https://github.com/CoCreate-app/CoCreate-cursors/commit/ece7b2cabe7548629661ea206dc688a333a95eff))
|
|
14
|
+
|
|
1
15
|
## [1.12.22](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.12.21...v1.12.22) (2022-12-13)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/cursors",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Collaborative user cursor position for inputs, textarea's and contenteditable elements.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cursors",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"clean-webpack-plugin": "^3.0.0",
|
|
54
54
|
"file-loader": "^6.2.0",
|
|
55
55
|
"mini-css-extract-plugin": "^1.5.0",
|
|
56
|
+
"style-loader": "^3.3.1",
|
|
56
57
|
"terser-webpack-plugin": "^5.1.1",
|
|
57
58
|
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
58
59
|
"webpack": "^5.24.4",
|
package/src/index.js
CHANGED
|
@@ -121,28 +121,31 @@ function drawCursors(selection) {
|
|
|
121
121
|
|
|
122
122
|
let computed = getComputedStyle(element);
|
|
123
123
|
let rect = element.getBoundingClientRect();
|
|
124
|
+
|
|
124
125
|
let borderWidth = parseInt(computed['border-width']) * 2;
|
|
125
126
|
let scrollBarWidth = 0;
|
|
126
127
|
if (element.clientWidth != 0)
|
|
127
128
|
scrollBarWidth = element.offsetWidth - element.clientWidth - borderWidth;
|
|
128
|
-
let style = mirrorDiv.style;
|
|
129
129
|
|
|
130
|
+
let style = mirrorDiv.style;
|
|
130
131
|
style.position = 'absolute';
|
|
131
132
|
style.width = rect.width + 'px';
|
|
132
133
|
style.height = rect.height + 'px';
|
|
133
|
-
style.visibility = 'visible';
|
|
134
134
|
style.overflowX = computed['overflowX'];
|
|
135
135
|
style.overflowY = computed['overflowY'];
|
|
136
136
|
style.margin = '0px';
|
|
137
|
-
style.
|
|
137
|
+
style.padding = computed['padding'];
|
|
138
138
|
style.border = computed['border'];
|
|
139
139
|
style.borderColor = 'transparent';
|
|
140
|
-
|
|
140
|
+
style.outline = computed['outline'];
|
|
141
|
+
style.outlineColor = 'transparent';
|
|
142
|
+
style.boxSizing = computed['boxSizing'];
|
|
143
|
+
style.lineHeight = computed['lineHeight'];
|
|
144
|
+
|
|
141
145
|
if (element.parentElement.style['display'] == 'inline') {
|
|
142
146
|
style.top = element.clientTop + 'px';
|
|
143
147
|
style.left = element.clientLeft + 'px';
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
148
|
+
} else {
|
|
146
149
|
style.top = element.offsetTop + 'px';
|
|
147
150
|
style.left = element.offsetLeft + 'px';
|
|
148
151
|
}
|
|
@@ -150,12 +153,11 @@ function drawCursors(selection) {
|
|
|
150
153
|
if (element.nodeName !== 'INPUT') {
|
|
151
154
|
style.wordWrap = 'break-word';
|
|
152
155
|
style.whiteSpace = 'pre-wrap';
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
156
|
+
} else {
|
|
155
157
|
style.whiteSpace = 'pre';
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
let properties = ['
|
|
160
|
+
let properties = ['fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontFamily', 'letterSpacing', 'lineHeight', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 'textRendering', 'textTransform', 'textIndent', 'overflowWrap', 'tabSize', 'webkitWritingMode', 'wordSpacing'];
|
|
159
161
|
|
|
160
162
|
properties.forEach(function(prop) {
|
|
161
163
|
if (['left', 'top'].indexOf(prop.toLowerCase()) === -1)
|