@cocreate/cursors 1.11.14 → 1.11.17
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 +22 -0
- package/CoCreate.config.js +1 -1
- package/package.json +1 -1
- package/src/index.js +20 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [1.11.17](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.16...v1.11.17) (2022-04-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* activeCursor element defined on window object ([c571c2d](https://github.com/CoCreate-app/CoCreate-cursors/commit/c571c2d707fc87d866c027753ffdbc9ea7eea498))
|
|
7
|
+
|
|
8
|
+
## [1.11.16](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.15...v1.11.16) (2022-03-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* removed emit from message.send and message.listen ([344cb05](https://github.com/CoCreate-app/CoCreate-cursors/commit/344cb0599ae4d50706c9e9fe48cb55a5b678740e))
|
|
14
|
+
|
|
15
|
+
## [1.11.15](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.14...v1.11.15) (2022-02-24)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* CoCreate.config replace CoCreate.app with * ([b35233f](https://github.com/CoCreate-app/CoCreate-cursors/commit/b35233f7fd94378bd75af295e78ec82d5794e4fe))
|
|
21
|
+
* typo enviroment to environment ([572e06b](https://github.com/CoCreate-app/CoCreate-cursors/commit/572e06b9e0db5ea698bfbc7027ef331d95263df1))
|
|
22
|
+
|
|
1
23
|
## [1.11.14](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.13...v1.11.14) (2022-02-16)
|
|
2
24
|
|
|
3
25
|
|
package/CoCreate.config.js
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import './index.css';
|
|
|
9
9
|
const clientId = window.CoCreateSockets.clientId || uuid.generate(12);
|
|
10
10
|
const cursorBackground = randomColor();
|
|
11
11
|
|
|
12
|
-
let
|
|
12
|
+
let environment_prod = true;
|
|
13
13
|
|
|
14
14
|
let selector = "[collection][document_id][name]:not([contentEditable='false'])";
|
|
15
15
|
|
|
@@ -58,8 +58,7 @@ function drawCursors(selection) {
|
|
|
58
58
|
elements = document.querySelectorAll(selector);
|
|
59
59
|
}
|
|
60
60
|
for (let element of elements) {
|
|
61
|
-
if (
|
|
62
|
-
// element.activeElement = '';
|
|
61
|
+
if (window.activeElement == element && selection.clientId == clientId) {
|
|
63
62
|
continue;
|
|
64
63
|
}
|
|
65
64
|
let realtime = element.getAttribute('realtime');
|
|
@@ -73,8 +72,8 @@ function drawCursors(selection) {
|
|
|
73
72
|
if (element.hasAttribute('contenteditable')) {
|
|
74
73
|
let domTextEditor = element;
|
|
75
74
|
if (element.tagName == 'IFRAME'){
|
|
76
|
-
let frameClientId = element.contentDocument.defaultView.CoCreateSockets.clientId;
|
|
77
|
-
if (frameClientId == selection.clientId) continue;
|
|
75
|
+
// let frameClientId = element.contentDocument.defaultView.CoCreateSockets.clientId;
|
|
76
|
+
// if (frameClientId == selection.clientId) continue;
|
|
78
77
|
domTextEditor = element.contentDocument.documentElement;
|
|
79
78
|
}
|
|
80
79
|
let pos = getElementPosition(domTextEditor.htmlString, start, end);
|
|
@@ -100,7 +99,7 @@ function drawCursors(selection) {
|
|
|
100
99
|
|
|
101
100
|
mirrorDiv = document.createElement('cursor-container');
|
|
102
101
|
mirrorDiv.id = id_mirror;
|
|
103
|
-
mirrorDiv.className = (
|
|
102
|
+
mirrorDiv.className = (environment_prod) ? 'mirror mirror_scroll mirror_color' : 'mirror mirror_scroll';
|
|
104
103
|
mirrorDiv.contentEditable = false;
|
|
105
104
|
mirrorDiv.element = element;
|
|
106
105
|
element.insertAdjacentElement('afterend', mirrorDiv);
|
|
@@ -311,21 +310,19 @@ function sendPosition(info) {
|
|
|
311
310
|
try {
|
|
312
311
|
message.send({
|
|
313
312
|
room: "",
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
},
|
|
313
|
+
message: "cursor",
|
|
314
|
+
data: {
|
|
315
|
+
collection: info.collection,
|
|
316
|
+
document_id: info.document_id,
|
|
317
|
+
name: info.name,
|
|
318
|
+
start: info.start,
|
|
319
|
+
end: info.end,
|
|
320
|
+
clientId: clientId,
|
|
321
|
+
color: info.color || localStorage.getItem("cursorColor"),
|
|
322
|
+
background: info.background || localStorage.getItem("cursorBackground") || cursorBackground,
|
|
323
|
+
userName: info.userName || localStorage.getItem("userName") || clientId,
|
|
324
|
+
user_id: info.user_id || localStorage.getItem("user_id") || clientId
|
|
325
|
+
}
|
|
329
326
|
});
|
|
330
327
|
}
|
|
331
328
|
catch (e) {
|
|
@@ -334,8 +331,9 @@ function sendPosition(info) {
|
|
|
334
331
|
}
|
|
335
332
|
|
|
336
333
|
|
|
337
|
-
message.listen('cursor', function(
|
|
334
|
+
message.listen('cursor', function(response) {
|
|
338
335
|
// if (selection.clientId == clientId) return;
|
|
336
|
+
let selection = response.data
|
|
339
337
|
if (selection.start != null && selection.end != null)
|
|
340
338
|
drawCursors(selection);
|
|
341
339
|
else
|