@cocreate/elements 1.6.1 → 1.6.2

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.6.2](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.6.1...v1.6.2) (2022-01-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * if crdt = true but document_id is empty save ([cd69a43](https://github.com/CoCreate-app/CoCreate-elements/commit/cd69a434ec33ac7f32ded29f715154f22a1bd4e8))
7
+
1
8
  ## [1.6.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.6.0...v1.6.1) (2022-01-02)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Fetch content into any html element by using html5 attributes to query data stored in CoCreate headless CMS. If data is changed it will instantly reflect in html tags as changes are broadcasted in realtime",
5
5
  "keywords": [
6
6
  "elements",
package/src/index.js CHANGED
@@ -39,11 +39,11 @@ function initElement(el) {
39
39
  if (el.closest('.template')) return;
40
40
 
41
41
  const { collection, document_id, name, isRead } = crud.getAttr(el);
42
+ __initEvents(el);
42
43
  if (!collection || !name) return;
43
44
  if (!document_id.match(/^[0-9a-fA-F]{24}$/)) return;
44
45
  if (!crud.checkAttrValue(collection) || !crud.checkAttrValue(name)) return;
45
46
 
46
- __initEvents(el);
47
47
  if (isRead == 'false') return;
48
48
  return {collection, document_id};
49
49
  }
@@ -119,7 +119,7 @@ function __initEvents(el) {
119
119
  el.addEventListener('input', function(e) {
120
120
  const {document_id, isRealtime, isCrdt} = crud.getAttr(el);
121
121
  if (isCrdt == "true" && document_id || isRealtime == "false") return;
122
- if (e.detail && e.detail.skip == true) return;
122
+ if (document_id && e.detail && e.detail.skip == true) return;
123
123
  save(el);
124
124
  });
125
125