@cocreate/cursors 1.11.34 → 1.12.0

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,10 @@
1
+ # [1.12.0](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.34...v1.12.0) (2022-11-21)
2
+
3
+
4
+ ### Features
5
+
6
+ * added crud.getAttributeNames to observer attributeName param, this will allow observing custom attributes ([cf37758](https://github.com/CoCreate-app/CoCreate-cursors/commit/cf377581c3f086f4a4edf5fc37cf1d7c20ae05d7))
7
+
1
8
  ## [1.11.34](https://github.com/CoCreate-app/CoCreate-cursors/compare/v1.11.33...v1.11.34) (2022-10-02)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/cursors",
3
- "version": "1.11.34",
3
+ "version": "1.12.0",
4
4
  "description": "Collaborative user cursor position for inputs, textarea's and contenteditable elements.",
5
5
  "keywords": [
6
6
  "cursors",
@@ -62,7 +62,7 @@
62
62
  "webpack-log": "^3.0.1"
63
63
  },
64
64
  "dependencies": {
65
- "@cocreate/crud-client": "^1.12.11",
65
+ "@cocreate/crud-client": "^1.12.13",
66
66
  "@cocreate/docs": "^1.3.17",
67
67
  "@cocreate/message-client": "^1.1.85",
68
68
  "@cocreate/observer": "^1.5.16",
package/src/index.js CHANGED
@@ -1,11 +1,18 @@
1
1
  /*globals localStorage, ResizeObserver*/
2
2
  import observer from '@cocreate/observer';
3
+ import CRUD from '@cocreate/crud-client';
3
4
  import message from '@cocreate/message-client';
4
5
  import uuid from '@cocreate/uuid';
5
6
  import { getElementPosition } from '@cocreate/selection';
6
7
  import {randomColor} from '@cocreate/random-color';
7
8
  import './index.css';
8
9
 
10
+ let crud
11
+ if(CRUD && CRUD.default)
12
+ crud = CRUD.default
13
+ else
14
+ crud = CRUD
15
+
9
16
  const clientId = message.socket.clientId || uuid.generate(12);
10
17
  const cursorBackground = randomColor();
11
18
 
@@ -352,7 +359,7 @@ observer.init({
352
359
  observer.init({
353
360
  name: 'CoCreateCursorAtt',
354
361
  observe: ['attributes'],
355
- attributeName: ['collection', 'document_id', 'name'],
362
+ attributeName: crud.getAttributeNames(['collection', 'document_id', 'name']),
356
363
  callback: function(mutation) {
357
364
  initElement(mutation.target);
358
365
  }