@cocreate/element-prototype 1.22.0 → 1.22.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,18 @@
1
+ ## [1.22.2](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.22.1...v1.22.2) (2024-04-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * try catch block for script insert ([eff2887](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/eff2887588e5a89ac4cb384cc17242ae29ad2363))
7
+
8
+ ## [1.22.1](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.22.0...v1.22.1) (2024-03-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * getAttribute type ([17545c2](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/17545c2c9ebb8766c455bce40a7e386f4fd94c47))
14
+ * handling of valueType text ([6e6663d](https://github.com/CoCreate-app/CoCreate-element-prototype/commit/6e6663db99938fee08178b5e8f136434632884e6))
15
+
1
16
  # [1.22.0](https://github.com/CoCreate-app/CoCreate-element-prototype/compare/v1.21.0...v1.22.0) (2024-02-20)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/element-prototype",
3
- "version": "1.22.0",
3
+ "version": "1.22.2",
4
4
  "description": "A simple element-prototype component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "element-prototype",
package/src/getValue.js CHANGED
@@ -79,7 +79,7 @@ const getValue = (element) => {
79
79
  optionValue = prefix + optionValue + suffix;
80
80
  value.push(optionValue);
81
81
  }
82
- } else if (["time", "date", "datetime", "datetime-local"].includes(element.type)) {
82
+ } else if (["time", "date", "datetime", "datetime-local"].includes(element.getAttribute('type'))) {
83
83
  if (value === '$now')
84
84
  value = new Date()
85
85
  else if (value)
@@ -124,6 +124,8 @@ const getValue = (element) => {
124
124
  value = element.srcdoc;
125
125
  } else if (element.hasAttribute('value')) {
126
126
  value = element.getAttribute('value');
127
+ } else if (valueType === 'text') {
128
+ value = element.innerText;
127
129
  } else {
128
130
  value = element.innerHTML;
129
131
  }
package/src/setValue.js CHANGED
@@ -191,7 +191,11 @@ function setScript(script, value) {
191
191
  else
192
192
  newScript.innerHTML = value;
193
193
  }
194
- script.replaceWith(newScript);
194
+ try {
195
+ script.replaceWith(newScript);
196
+ } catch (error) {
197
+ console.log(error)
198
+ }
195
199
  }
196
200
 
197
201
  function __decryptPassword(str) {