@cocreate/elements 1.14.8 → 1.15.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [1.15.1](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.15.0...v1.15.1) (2023-01-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * compare doument_id with element before seting value ([426b2d7](https://github.com/CoCreate-app/CoCreate-elements/commit/426b2d719eb9e0f012f05608ea1f70da463651f6))
7
+
8
+ # [1.15.0](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.14.8...v1.15.0) (2023-01-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bump dependencies ([c4afd3c](https://github.com/CoCreate-app/CoCreate-elements/commit/c4afd3c24e1c0962f3c7281333ff628541b15ef9))
14
+
15
+
16
+ ### Features
17
+
18
+ * use setValue() ([fd14270](https://github.com/CoCreate-app/CoCreate-elements/commit/fd14270bd8a92cc8c6117bbbc11f247962d32515))
19
+
1
20
  ## [1.14.8](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.14.7...v1.14.8) (2023-01-09)
2
21
 
3
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/elements",
3
- "version": "1.14.8",
3
+ "version": "1.15.1",
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",
@@ -60,11 +60,11 @@
60
60
  "webpack-log": "^3.0.1"
61
61
  },
62
62
  "dependencies": {
63
- "@cocreate/actions": "^1.5.51",
64
- "@cocreate/crud-client": "^1.17.14",
65
- "@cocreate/docs": "^1.5.5",
66
- "@cocreate/element-prototype": "^1.2.27",
67
- "@cocreate/observer": "^1.5.55",
68
- "@cocreate/utils": "^1.17.18"
63
+ "@cocreate/actions": "^1.5.52",
64
+ "@cocreate/crud-client": "^1.17.15",
65
+ "@cocreate/docs": "^1.5.6",
66
+ "@cocreate/element-prototype": "^1.4.2",
67
+ "@cocreate/observer": "^1.5.56",
68
+ "@cocreate/utils": "^1.17.19"
69
69
  }
70
70
  }
package/src/fetchSrc.js CHANGED
@@ -21,29 +21,14 @@ async function initElement(element) {
21
21
  initializing.set(element, {src});
22
22
  if (src) {
23
23
  try {
24
- let response = await fetch(src); // Gets a promise
25
- let text = await response.text(); // Replaces body with response
24
+ let response = await fetch(src);
25
+ let text = await response.text();
26
26
  if (text) {
27
- let dom = document.createElement('dom')
28
- dom.innerHTML = text;
29
-
30
- let CoCreateJS = dom.querySelector('script[src*="CoCreate.js"], script[src*="CoCreate.min.js"]')
31
- if (CoCreateJS)
32
- CoCreateJS.remove()
33
-
34
- let CoCreateCSS = dom.querySelector('link[href*="CoCreate.css"], link[href*="CoCreate.min.css"]')
35
- if (CoCreateCSS)
36
- CoCreateCSS.remove()
37
-
38
- let css = dom.querySelector('link[collection], link[document]')
39
- if (css)
40
- css.remove()
41
-
42
- element.innerHTML = dom.innerHTML; // Replaces body with response
27
+ element.setValue(text);
43
28
  initializing.delete(element)
44
29
  }
45
30
  } catch (err) {
46
- console.log('FetchSrc error:' + err); // Error handling
31
+ console.log('FetchSrc error:' + err);
47
32
  }
48
33
  }
49
34
  }
package/src/index.js CHANGED
@@ -129,7 +129,7 @@ function setData(elements, data) {
129
129
  if (el.hasAttribute('actions')) continue;
130
130
  if (isRead == "false" || isUpdate == "false" || isCrdt == "true") continue;
131
131
 
132
- if (data.document[0]['collection'] == collection) {
132
+ if (data.document[0]['collection'] == collection && data.document[0]['_id'] == document_id) {
133
133
  let value;
134
134
  let valueType = el.getAttribute('value-type');
135
135
  if (valueType == 'object' || valueType == 'json'){