@cocreate/cursors 1.11.13 → 1.11.16

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,25 @@
1
+ ## [1.11.16](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.15...v1.11.16) (2022-03-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * removed emit from message.send and message.listen ([344cb05](https://github.com/CoCreate-app/CoCreate-cursors/commit/344cb0599ae4d50706c9e9fe48cb55a5b678740e))
7
+
8
+ ## [1.11.15](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.14...v1.11.15) (2022-02-24)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * CoCreate.config replace CoCreate.app with * ([b35233f](https://github.com/CoCreate-app/CoCreate-cursors/commit/b35233f7fd94378bd75af295e78ec82d5794e4fe))
14
+ * typo enviroment to environment ([572e06b](https://github.com/CoCreate-app/CoCreate-cursors/commit/572e06b9e0db5ea698bfbc7027ef331d95263df1))
15
+
16
+ ## [1.11.14](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.13...v1.11.14) (2022-02-16)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * update dependencies ([249ef24](https://github.com/CoCreate-app/CoCreate-cursors/commit/249ef249a8990268c11f449dd1295a486a9ab03c))
22
+
1
23
  ## [1.11.13](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.12...v1.11.13) (2022-02-10)
2
24
 
3
25
 
@@ -14,7 +14,7 @@ module.exports = {
14
14
  "name": "index.html",
15
15
  "path": "/docs/cursors/index.html",
16
16
  "domains": [
17
- "cocreate.app",
17
+ "*",
18
18
  "general.cocreate.app"
19
19
  ],
20
20
  "directory": "/docs/cursors",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cursors",
3
- "version": "1.11.13",
3
+ "version": "1.11.16",
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.46",
66
- "@cocreate/docs": "^1.2.68",
67
- "@cocreate/message-client": "^1.1.63",
68
- "@cocreate/observer": "^1.4.3",
69
- "@cocreate/random-color": "^1.2.20",
70
- "@cocreate/selection": "^1.4.3",
71
- "@cocreate/uuid": "^1.1.58"
65
+ "@cocreate/crud-client": "^1.4.47",
66
+ "@cocreate/docs": "^1.2.69",
67
+ "@cocreate/message-client": "^1.1.64",
68
+ "@cocreate/observer": "^1.4.4",
69
+ "@cocreate/random-color": "^1.2.21",
70
+ "@cocreate/selection": "^1.4.4",
71
+ "@cocreate/uuid": "^1.1.59"
72
72
  }
73
73
  }
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 enviroment_prod = true;
12
+ let environment_prod = true;
13
13
 
14
14
  let selector = "[collection][document_id][name]:not([contentEditable='false'])";
15
15
 
@@ -100,7 +100,7 @@ function drawCursors(selection) {
100
100
 
101
101
  mirrorDiv = document.createElement('cursor-container');
102
102
  mirrorDiv.id = id_mirror;
103
- mirrorDiv.className = (enviroment_prod) ? 'mirror mirror_scroll mirror_color' : 'mirror mirror_scroll';
103
+ mirrorDiv.className = (environment_prod) ? 'mirror mirror_scroll mirror_color' : 'mirror mirror_scroll';
104
104
  mirrorDiv.contentEditable = false;
105
105
  mirrorDiv.element = element;
106
106
  element.insertAdjacentElement('afterend', mirrorDiv);
@@ -311,21 +311,19 @@ function sendPosition(info) {
311
311
  try {
312
312
  message.send({
313
313
  room: "",
314
- emit: {
315
- message: "cursor",
316
- data: {
317
- collection: info.collection,
318
- document_id: info.document_id,
319
- name: info.name,
320
- start: info.start,
321
- end: info.end,
322
- clientId: clientId,
323
- color: info.color || localStorage.getItem("cursorColor"),
324
- background: info.background || localStorage.getItem("cursorBackground") || cursorBackground,
325
- userName: info.userName || localStorage.getItem("userName") || clientId,
326
- user_id: info.user_id || localStorage.getItem("user_id") || clientId
327
- }
328
- },
314
+ message: "cursor",
315
+ data: {
316
+ collection: info.collection,
317
+ document_id: info.document_id,
318
+ name: info.name,
319
+ start: info.start,
320
+ end: info.end,
321
+ clientId: clientId,
322
+ color: info.color || localStorage.getItem("cursorColor"),
323
+ background: info.background || localStorage.getItem("cursorBackground") || cursorBackground,
324
+ userName: info.userName || localStorage.getItem("userName") || clientId,
325
+ user_id: info.user_id || localStorage.getItem("user_id") || clientId
326
+ }
329
327
  });
330
328
  }
331
329
  catch (e) {
@@ -334,8 +332,9 @@ function sendPosition(info) {
334
332
  }
335
333
 
336
334
 
337
- message.listen('cursor', function(selection) {
335
+ message.listen('cursor', function(response) {
338
336
  // if (selection.clientId == clientId) return;
337
+ let selection = response.data
339
338
  if (selection.start != null && selection.end != null)
340
339
  drawCursors(selection);
341
340
  else