@cocreate/cursors 1.11.15 → 1.11.18

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,24 @@
1
+ ## [1.11.18](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.17...v1.11.18) (2022-05-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update config organization_Id to organization_id ([aea8b14](https://github.com/CoCreate-app/CoCreate-cursors/commit/aea8b146bafde0c2c181db5cdc30a31b4b0fcea9))
7
+
8
+ ## [1.11.17](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.16...v1.11.17) (2022-04-30)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * activeCursor element defined on window object ([c571c2d](https://github.com/CoCreate-app/CoCreate-cursors/commit/c571c2d707fc87d866c027753ffdbc9ea7eea498))
14
+
15
+ ## [1.11.16](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.15...v1.11.16) (2022-03-22)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * removed emit from message.send and message.listen ([344cb05](https://github.com/CoCreate-app/CoCreate-cursors/commit/344cb0599ae4d50706c9e9fe48cb55a5b678740e))
21
+
1
22
  ## [1.11.15](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.14...v1.11.15) (2022-02-24)
2
23
 
3
24
 
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  "config": {
3
3
  "apiKey": "2061acef-0451-4545-f754-60cf8160",
4
- "organization_Id": "5ff747727005da1c272740ab",
4
+ "organization_id": "5ff747727005da1c272740ab",
5
5
  "host": "general.cocreate.app"
6
6
  },
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cursors",
3
- "version": "1.11.15",
3
+ "version": "1.11.18",
4
4
  "description": "Collaborative user cursor position for inputs, textarea's and contenteditable elements.",
5
5
  "keywords": [
6
6
  "cursors",
package/src/index.js CHANGED
@@ -58,8 +58,7 @@ function drawCursors(selection) {
58
58
  elements = document.querySelectorAll(selector);
59
59
  }
60
60
  for (let element of elements) {
61
- if (element.activeElement && selection.clientId == clientId) {
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);
@@ -311,21 +310,19 @@ function sendPosition(info) {
311
310
  try {
312
311
  message.send({
313
312
  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
- },
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(selection) {
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