@cocreate/cursors 1.11.4 → 1.11.8
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 +28 -0
- package/package.json +1 -1
- package/src/index.js +26 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [1.11.8](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.7...v1.11.8) (2022-01-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* If element is not contenteditable do not display cursors unless cursors=true ([be7d653](https://github.com/CoCreate-app/CoCreate-cursors/commit/be7d65339d73234f95bbec4400d6ead0adfec9ef))
|
|
7
|
+
|
|
8
|
+
## [1.11.7](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.6...v1.11.7) (2022-01-13)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* commented parentElement.style postion:relative and display:inline ([b2123b6](https://github.com/CoCreate-app/CoCreate-cursors/commit/b2123b6ffe9e197f2f071b36c1c3419d9db71619))
|
|
14
|
+
|
|
15
|
+
## [1.11.6](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.5...v1.11.6) (2022-01-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* removed commented code ([6eabd19](https://github.com/CoCreate-app/CoCreate-cursors/commit/6eabd1955963b44ba6db6259f0a492ddfe2cd54a))
|
|
21
|
+
|
|
22
|
+
## [1.11.5](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.4...v1.11.5) (2022-01-11)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* if parent position is static add relative to contain cursor-container ([76f23c1](https://github.com/CoCreate-app/CoCreate-cursors/commit/76f23c1520fdc270f325885332ccf67bab6787ed))
|
|
28
|
+
|
|
1
29
|
## [1.11.4](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.3...v1.11.4) (2022-01-01)
|
|
2
30
|
|
|
3
31
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -54,7 +54,7 @@ function drawCursors(selection) {
|
|
|
54
54
|
let elements = selection.element;
|
|
55
55
|
if (!elements) {
|
|
56
56
|
let selector = '[collection="' + collection + '"][document_id="' + document_id + '"][name="' + name + '"]';
|
|
57
|
-
selector += ':not(.codemirror, .
|
|
57
|
+
selector += ':not(.codemirror, .monaco, [actions])';
|
|
58
58
|
elements = document.querySelectorAll(selector);
|
|
59
59
|
}
|
|
60
60
|
for (let element of elements) {
|
|
@@ -62,6 +62,11 @@ function drawCursors(selection) {
|
|
|
62
62
|
// element.activeElement = '';
|
|
63
63
|
continue;
|
|
64
64
|
}
|
|
65
|
+
if (element.tagName != 'INPUT' || element.tagName != 'TEXTAREA'){
|
|
66
|
+
if (!element.hasAttribute('contenteditable') && element.getAttribute('cursors') != 'true') {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
65
70
|
let realtime = element.getAttribute('realtime');
|
|
66
71
|
let cursors = element.getAttribute('cursors');
|
|
67
72
|
if (realtime == 'false' || cursors == 'false') continue;
|
|
@@ -98,6 +103,15 @@ function drawCursors(selection) {
|
|
|
98
103
|
mirrorDiv.contentEditable = false;
|
|
99
104
|
mirrorDiv.element = element;
|
|
100
105
|
element.insertAdjacentElement('afterend', mirrorDiv);
|
|
106
|
+
// let parent = element.parentElement;
|
|
107
|
+
// let parentComputed = getComputedStyle(parent);
|
|
108
|
+
// let parentStylePosition = parentComputed['position'];
|
|
109
|
+
// if (parentStylePosition == 'static')
|
|
110
|
+
// parent.style.position = 'relative';
|
|
111
|
+
// let parentStyleDisplay = parentComputed['display'];
|
|
112
|
+
// if (parentStyleDisplay == 'inline')
|
|
113
|
+
// parent.style.display = 'inline';
|
|
114
|
+
|
|
101
115
|
_initEvents(element);
|
|
102
116
|
initDocument(document);
|
|
103
117
|
}
|
|
@@ -111,10 +125,8 @@ function drawCursors(selection) {
|
|
|
111
125
|
if (element.clientWidth != 0)
|
|
112
126
|
scrollBarWidth = element.offsetWidth - element.clientWidth - borderWidth;
|
|
113
127
|
let style = mirrorDiv.style;
|
|
114
|
-
|
|
128
|
+
|
|
115
129
|
style.position = 'absolute';
|
|
116
|
-
style.top = element.offsetTop + 'px';
|
|
117
|
-
style.left = element.offsetLeft + 'px';
|
|
118
130
|
style.width = rect.width + 'px';
|
|
119
131
|
style.height = rect.height + 'px';
|
|
120
132
|
style.visibility = 'visible';
|
|
@@ -124,7 +136,16 @@ function drawCursors(selection) {
|
|
|
124
136
|
style.paddingRight = parseInt(computed['paddingRight']) + scrollBarWidth + 'px';
|
|
125
137
|
style.border = computed['border'];
|
|
126
138
|
style.borderColor = 'transparent';
|
|
127
|
-
|
|
139
|
+
|
|
140
|
+
if (element.parentElement.style['display'] == 'inline') {
|
|
141
|
+
style.top = element.clientTop + 'px';
|
|
142
|
+
style.left = element.clientLeft + 'px';
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
style.top = element.offsetTop + 'px';
|
|
146
|
+
style.left = element.offsetLeft + 'px';
|
|
147
|
+
}
|
|
148
|
+
|
|
128
149
|
if (element.nodeName !== 'INPUT') {
|
|
129
150
|
style.wordWrap = 'break-word';
|
|
130
151
|
style.whiteSpace = 'pre-wrap';
|