@cocreate/cursors 1.19.2 → 1.20.1

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.
@@ -41,30 +41,4 @@ jobs:
41
41
  outputs:
42
42
  new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
43
43
  new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
44
- upload:
45
- runs-on: ubuntu-latest
46
- needs: release
47
- if: needs.release.outputs.new_release_published == 'true'
48
- env:
49
- VERSION: "${{ needs.release.outputs.new_release_version }}"
50
- steps:
51
- - name: Checkout
52
- uses: actions/checkout@v3
53
- - name: Setup Node.js
54
- uses: actions/setup-node@v3
55
- with:
56
- node-version: 16
57
- - name: Set npm registry auth
58
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
59
- - name: Install dependencies
60
- run: yarn install
61
- - name: Build
62
- run: yarn build
63
- - name: Set Environment Variables
64
- run: |
65
- echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
66
- echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
67
- echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
68
- - name: CoCreate Upload
69
- run: coc upload
70
44
 
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [1.20.1](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.20.0...v1.20.1) (2023-10-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * replaced socketId with socket.has(data.sockeId) ([b3515d7](https://github.com/CoCreate-app/CoCreate-cursors/commit/b3515d7d13758210624b0e4d0ee6cda2a0c3a382))
7
+ * update to use data.socketId and data.clientId ([1d780ec](https://github.com/CoCreate-app/CoCreate-cursors/commit/1d780ec9998235075347e8da0ed7d753b43cf46c))
8
+
9
+ # [1.20.0](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.19.2...v1.20.0) (2023-09-19)
10
+
11
+
12
+ ### Features
13
+
14
+ * Update CoCreate dependencies to their latest versions ([2f76827](https://github.com/CoCreate-app/CoCreate-cursors/commit/2f768273523e9e296814ba34882b2c62240ee51a))
15
+
1
16
  ## [1.19.2](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.19.1...v1.19.2) (2023-09-18)
2
17
 
3
18
 
@@ -1,24 +1,24 @@
1
- module.exports = {
2
- "organization_id": "",
3
- "key": "",
4
- "host": "",
5
- "sources": [
6
- {
7
- "array": "files",
8
- "object": {
9
- "_id": "6019eae64eea0817df303b12",
10
- "name": "index.html",
11
- "path": "/docs/cursors",
12
- "pathname": "/docs/cursors/index.html",
13
- "src": "{{./docs/index.html}}",
14
- "host": [
15
- "*",
16
- "general.cocreate.app"
17
- ],
18
- "directory": "cursors",
19
- "content-type": "{{content-type}}",
20
- "public": "true"
21
- }
22
- }
23
- ]
24
- }
1
+ module.exports = {
2
+ "organization_id": "",
3
+ "key": "",
4
+ "host": "",
5
+ "sources": [
6
+ {
7
+ "array": "files",
8
+ "object": {
9
+ "_id": "6019eae64eea0817df303b12",
10
+ "name": "index.html",
11
+ "path": "/docs/cursors",
12
+ "pathname": "/docs/cursors/index.html",
13
+ "src": "{{./docs/index.html}}",
14
+ "host": [
15
+ "*",
16
+ "general.cocreate.app"
17
+ ],
18
+ "directory": "cursors",
19
+ "content-type": "{{content-type}}",
20
+ "public": "true"
21
+ }
22
+ }
23
+ ]
24
+ };
package/docs/index.html CHANGED
@@ -269,7 +269,6 @@
269
269
  </div>
270
270
  </main>
271
271
 
272
- <script src="/apikey.js"></script>
273
272
  <script src="https://CoCreate.app/dist/CoCreate.js"></script>
274
273
  </body>
275
274
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cursors",
3
- "version": "1.19.2",
3
+ "version": "1.20.1",
4
4
  "description": "Collaborative user cursor position for inputs, textarea's and contenteditable elements.",
5
5
  "keywords": [
6
6
  "cursors",
@@ -59,12 +59,12 @@
59
59
  "webpack-log": "^3.0.1"
60
60
  },
61
61
  "dependencies": {
62
- "@cocreate/local-storage": "^1.10.1",
63
- "@cocreate/message-client": "^1.6.1",
64
- "@cocreate/observer": "^1.11.1",
65
- "@cocreate/random-color": "^1.7.1",
66
- "@cocreate/selection": "^1.9.1",
67
- "@cocreate/utils": "^1.24.1",
68
- "@cocreate/uuid": "^1.7.1"
62
+ "@cocreate/local-storage": "^1.10.2",
63
+ "@cocreate/message-client": "^1.8.0",
64
+ "@cocreate/observer": "^1.11.2",
65
+ "@cocreate/random-color": "^1.7.2",
66
+ "@cocreate/selection": "^1.9.2",
67
+ "@cocreate/utils": "^1.24.2",
68
+ "@cocreate/uuid": "^1.7.2"
69
69
  }
70
70
  }
package/src/index.js CHANGED
@@ -79,7 +79,7 @@ function initDocument(doc) {
79
79
  }
80
80
 
81
81
  function drawCursors(selection) {
82
- const socket_id = selection['clientId'];
82
+ const socket_id = selection['socketId'];
83
83
  const array = selection['array'];
84
84
  const object = selection['object'];
85
85
  const key = selection['key'];
@@ -92,7 +92,7 @@ function drawCursors(selection) {
92
92
  elements = document.querySelectorAll(selector);
93
93
  }
94
94
  for (let element of elements) {
95
- if (window.activeElement == element && selection.clientId == clientId) {
95
+ if (window.activeElement == element && message.socket.has(selection.socketId)) {
96
96
  continue;
97
97
  }
98
98
  let realtime = element.getAttribute('realtime');
@@ -106,8 +106,8 @@ function drawCursors(selection) {
106
106
  if (element.hasAttribute('contenteditable')) {
107
107
  let domTextEditor = element;
108
108
  if (element.tagName == 'IFRAME') {
109
- // let frameClientId = element.contentDocument.defaultView.CoCreateSockets.clientId;
110
- // if (frameClientId == selection.clientId) continue;
109
+ // let frameClientId = element.contentDocument.defaultView.CoCreateSockets.id;
110
+ // if (frameClientId == selection.socketId) continue;
111
111
  domTextEditor = element.contentDocument.documentElement;
112
112
  }
113
113
  if (!domTextEditor.htmlString)
@@ -283,7 +283,7 @@ function updateCursors(element) {
283
283
  let cursors = mirrorDiv.querySelectorAll('cursor');
284
284
 
285
285
  cursors.forEach(function (child_cursor, index, array) {
286
- let clientId = child_cursor.getAttribute('socket_id');
286
+ let socketId = child_cursor.getAttribute('socket_id');
287
287
  let userName = child_cursor.getAttribute('user-name');
288
288
  let background = child_cursor.getAttribute('user-background');
289
289
  let color = child_cursor.getAttribute('user-color');
@@ -293,7 +293,7 @@ function updateCursors(element) {
293
293
  element: [element],
294
294
  start,
295
295
  end,
296
- clientId,
296
+ socketId,
297
297
  userName,
298
298
  background,
299
299
  color
@@ -303,13 +303,13 @@ function updateCursors(element) {
303
303
  }
304
304
  }
305
305
 
306
- function removeCursor(clientId) {
307
- let elements = document.querySelectorAll(`cursor[socket_id="${clientId}"]`);
306
+ function removeCursor(socketId) {
307
+ let elements = document.querySelectorAll(`cursor[socket_id="${socketId}"]`);
308
308
  elements.forEach(function (element, index, array) {
309
309
  element.parentNode.removeChild(element);
310
310
  });
311
311
 
312
- let sel_elements = document.querySelectorAll(`selection[socket_id="${clientId}"]`);
312
+ let sel_elements = document.querySelectorAll(`selection[socket_id="${socketId}"]`);
313
313
  sel_elements.forEach(function (sel_element, index, array) {
314
314
  sel_element.parentNode.removeChild(sel_element);
315
315
  });
@@ -351,13 +351,12 @@ function sendPosition(info) {
351
351
  key: info.key,
352
352
  start: info.start,
353
353
  end: info.end,
354
- clientId: clientId,
355
354
  color: info.color || localStorage.getItem("cursorColor"),
356
355
  background: info.background || localStorage.getItem("cursorBackground") || cursorBackground,
357
356
  userName: info.userName || localStorage.getItem("userName") || clientId,
358
357
  user_id: info.user_id || localStorage.getItem("user_id") || clientId
359
358
  },
360
- broadcastBrowser: 'once'
359
+ broadcastBrowser: true
361
360
  });
362
361
  }
363
362
  catch (e) {
@@ -367,12 +366,12 @@ function sendPosition(info) {
367
366
 
368
367
 
369
368
  message.listen('cursor', function (response) {
370
- // if (selection.clientId == clientId) return;
369
+ // if (message.socket.has(selection.socketId)) return;
371
370
  let selection = response.data
372
371
  if (selection.start != null && selection.end != null)
373
372
  drawCursors(selection);
374
373
  else
375
- removeCursor(selection.clientId);
374
+ removeCursor(selection.socketId);
376
375
  });
377
376
 
378
377
  observer.init({