@cocreate/elements 1.4.6 → 1.4.10
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 +29 -0
- package/package.json +5 -5
- package/src/getValue.js +24 -7
- package/src/index.js +1 -1
- package/src/setValue.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## [1.4.10](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.4.9...v1.4.10) (2021-12-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* firefox setValue content is removed if iframe.srcDoc is removed ([68da8ec](https://github.com/CoCreate-app/CoCreate-elements/commit/68da8ec1736997af6e814e50c737b8761013a5b7))
|
|
7
|
+
|
|
8
|
+
## [1.4.9](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.4.8...v1.4.9) (2021-12-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update dependencies ([bdaac79](https://github.com/CoCreate-app/CoCreate-elements/commit/bdaac7913394558924241d4bd284834b0c26b626))
|
|
14
|
+
|
|
15
|
+
## [1.4.8](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.4.7...v1.4.8) (2021-12-14)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update dependencies ([2978bf0](https://github.com/CoCreate-app/CoCreate-elements/commit/2978bf01751416468ed1677b30cfc47c592bf6ab))
|
|
21
|
+
|
|
22
|
+
## [1.4.7](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.4.6...v1.4.7) (2021-11-27)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* actions import typo ([b9bd832](https://github.com/CoCreate-app/CoCreate-elements/commit/b9bd832c5bef3b5c53b7ef701f36d4c8529da857))
|
|
28
|
+
* update dependencies ([401df52](https://github.com/CoCreate-app/CoCreate-elements/commit/401df52d255d9f96e9f62da56cd4003ce54ca32b))
|
|
29
|
+
|
|
1
30
|
## [1.4.6](https://github.com/CoCreate-app/CoCreate-elements/compare/v1.4.5...v1.4.6) (2021-11-27)
|
|
2
31
|
|
|
3
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/elements",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.10",
|
|
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",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"webpack-log": "^3.0.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@cocreate/actions": "^1.3.
|
|
65
|
-
"@cocreate/crud-client": "^1.4.
|
|
66
|
-
"@cocreate/docs": "^1.2.
|
|
67
|
-
"@cocreate/observer": "^1.3.
|
|
64
|
+
"@cocreate/actions": "^1.3.25",
|
|
65
|
+
"@cocreate/crud-client": "^1.4.40",
|
|
66
|
+
"@cocreate/docs": "^1.2.62",
|
|
67
|
+
"@cocreate/observer": "^1.3.54"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/getValue.js
CHANGED
|
@@ -18,15 +18,17 @@ function initElement(element) {
|
|
|
18
18
|
let value = getValue(valueEl)
|
|
19
19
|
setValue(element, value)
|
|
20
20
|
|
|
21
|
-
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(valueEl.tagName) || valueEl.contentEditable)
|
|
21
|
+
// if (['INPUT', 'TEXTAREA', 'SELECT'].includes(valueEl.tagName) || valueEl.contentEditable)
|
|
22
22
|
|
|
23
|
-
valueEl.addEventListener('input', (e) => {
|
|
24
|
-
|
|
25
|
-
})
|
|
23
|
+
// valueEl.addEventListener('input', (e) => {
|
|
24
|
+
// setValueByFind(e.target)
|
|
25
|
+
// })
|
|
26
26
|
|
|
27
|
-
valueEl.addEventListener('updated_by_fetch', (e) => {
|
|
28
|
-
|
|
29
|
-
})
|
|
27
|
+
// valueEl.addEventListener('updated_by_fetch', (e) => {
|
|
28
|
+
// setValueByFind(e.target)
|
|
29
|
+
// })
|
|
30
|
+
|
|
31
|
+
initEvents(valueEl);
|
|
30
32
|
|
|
31
33
|
element.dispatchEvent(new Event("input", {
|
|
32
34
|
"bubbles": true
|
|
@@ -34,6 +36,21 @@ function initElement(element) {
|
|
|
34
36
|
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
const valueEls = new Map();
|
|
40
|
+
function initEvents(valueEl){
|
|
41
|
+
if (!valueEls.has(valueEl)) {
|
|
42
|
+
valueEls.set(valueEl);
|
|
43
|
+
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(valueEl.tagName) || valueEl.contentEditable)
|
|
44
|
+
valueEl.addEventListener('input', (e) => {
|
|
45
|
+
setValueByFind(e.target)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
valueEl.addEventListener('updated_by_fetch', (e) => {
|
|
49
|
+
setValueByFind(e.target)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
function setValueByFind(valueEl){
|
|
38
55
|
let value = getValue(valueEl)
|
|
39
56
|
let id = valueEl.getAttribute('id')
|
package/src/index.js
CHANGED
package/src/setValue.js
CHANGED
|
@@ -38,6 +38,11 @@ var setValue = (el, value) => {
|
|
|
38
38
|
|
|
39
39
|
else if (el.tagName === 'IFRAME') {
|
|
40
40
|
el.srcdoc = value;
|
|
41
|
+
// el.contentDocument.documentElement.innerHTML = value;
|
|
42
|
+
if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
|
|
43
|
+
// Do Firefox-related activities
|
|
44
|
+
}
|
|
45
|
+
else
|
|
41
46
|
el.onload = function(e) {
|
|
42
47
|
el.removeAttribute('srcdoc');
|
|
43
48
|
};
|