@cocreate/utils 1.3.19 → 1.4.3
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 +28 -0
- package/docs/index.html +1 -1
- package/package.json +2 -2
- package/src/index.js +23 -10
- package/src/index.old.js +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [1.4.3](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.4.2...v1.4.3) (2022-01-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* get-value attribute value now supports a selector added # to all values currently in get-value attributes ([d48bcd5](https://github.com/CoCreate-app/CoCreate-utils/commit/d48bcd5bdbc715b3aacb8db3b99cd8aa581b72ce))
|
|
7
|
+
|
|
8
|
+
## [1.4.2](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.4.1...v1.4.2) (2021-12-25)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* comment cssPath class parser. path could not resolve element ([1a00794](https://github.com/CoCreate-app/CoCreate-utils/commit/1a00794a0ee96699379e8efd0e75000efe93cded))
|
|
14
|
+
|
|
15
|
+
## [1.4.1](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.4.0...v1.4.1) (2021-12-15)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* update dependencies ([a36e4a6](https://github.com/CoCreate-app/CoCreate-utils/commit/a36e4a6356fdf7e25351895c9897e0f31341a9e1))
|
|
21
|
+
|
|
22
|
+
# [1.4.0](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.3.19...v1.4.0) (2021-12-14)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* cssPath and domParser update to support nested contenteditable elements ([a7b700a](https://github.com/CoCreate-app/CoCreate-utils/commit/a7b700add647856071cf2c3bfa0ce95b36144e0a))
|
|
28
|
+
|
|
1
29
|
## [1.3.19](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.3.18...v1.3.19) (2021-12-08)
|
|
2
30
|
|
|
3
31
|
|
package/docs/index.html
CHANGED
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
<div class="svSplitter svHorizontal"> </div>
|
|
118
118
|
|
|
119
119
|
<div class="svPanel">
|
|
120
|
-
<iframe get-value="demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
|
|
120
|
+
<iframe get-value="#demo" frameBorder="0" height="100%" width="100%" class="min-width:300px"></iframe>
|
|
121
121
|
</div>
|
|
122
122
|
|
|
123
123
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/utils",
|
|
3
|
-
"version": "1.3
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "A simple utils component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"utils",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"webpack-log": "^3.0.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@cocreate/docs": "^1.2.
|
|
64
|
+
"@cocreate/docs": "^1.2.62"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/index.js
CHANGED
|
@@ -17,6 +17,10 @@ export function cssPath(node, container) {
|
|
|
17
17
|
do {
|
|
18
18
|
if (!node || !node.tagName) return false;
|
|
19
19
|
let pathSplit = node.tagName.toLowerCase();
|
|
20
|
+
// if (node.tagName == "DOM-PARSER" || node.hasAttribute('contenteditable')){
|
|
21
|
+
// pathSplit = "[contenteditable]";
|
|
22
|
+
// node = '';
|
|
23
|
+
// }
|
|
20
24
|
if (node.id){
|
|
21
25
|
pathSplit += "#" + node.id;
|
|
22
26
|
node = '';
|
|
@@ -28,24 +32,33 @@ export function cssPath(node, container) {
|
|
|
28
32
|
node = '';
|
|
29
33
|
}
|
|
30
34
|
else {
|
|
31
|
-
if (node.classList.length) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
35
|
+
// if (node.classList.length) {
|
|
36
|
+
// node.classList.forEach((item) => {
|
|
37
|
+
// if (item.indexOf(":") === -1) pathSplit += "." + item;
|
|
38
|
+
// });
|
|
39
|
+
// }
|
|
36
40
|
|
|
37
41
|
if (node.parentNode && node.parentNode.children.length > 1) {
|
|
38
|
-
|
|
42
|
+
// ToDo: improve array logic so ignores javascript generated html??
|
|
43
|
+
let children = []
|
|
44
|
+
for (let child of node.parentNode.children){
|
|
45
|
+
// if (!child.matches('.mirror'))
|
|
46
|
+
// children.push(child);
|
|
47
|
+
if (child.tagName == node.tagName)
|
|
48
|
+
children.push(child);
|
|
49
|
+
}
|
|
39
50
|
let index = Array.prototype.indexOf.call(
|
|
40
|
-
|
|
51
|
+
children,
|
|
41
52
|
node
|
|
42
53
|
);
|
|
43
|
-
|
|
54
|
+
// if (children.length > 1)
|
|
55
|
+
// pathSplit += `:nth-child(${index + 1})`;
|
|
56
|
+
pathSplit += `:nth-of-type(${index + 1})`;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
// pathSplits.unshift(pathSplit);
|
|
47
60
|
node = node.parentNode;
|
|
48
|
-
if (node == null || node.tagName == "HTML" || node.nodeName == "#document" || node.hasAttribute('contenteditable'))
|
|
61
|
+
if (node == null || node.tagName == "HTML" || node.tagName == "DOM-PARSER" || node.nodeName == "#document" || node.hasAttribute('contenteditable'))
|
|
49
62
|
node = '';
|
|
50
63
|
}
|
|
51
64
|
}
|
|
@@ -73,7 +86,7 @@ export function domParser(str) {
|
|
|
73
86
|
return doc.head;
|
|
74
87
|
|
|
75
88
|
default:
|
|
76
|
-
let con = document.createElement('
|
|
89
|
+
let con = document.createElement('dom-parser');
|
|
77
90
|
con.innerHTML = str;
|
|
78
91
|
return con;
|
|
79
92
|
}
|
package/src/index.old.js
CHANGED
|
@@ -345,6 +345,17 @@ async function complexSelector(comSelector, callback) {
|
|
|
345
345
|
return callback(canvas.contentWindow.document, selector);
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
// function eid(html){
|
|
349
|
+
// let dom = domParser(html);
|
|
350
|
+
// let elements = dom.querySelectorAll('*');
|
|
351
|
+
// for (let element of elements){
|
|
352
|
+
// if (!element.getAttribute('eid')){
|
|
353
|
+
// element.setAttribute(eid, uuid(8))
|
|
354
|
+
// }
|
|
355
|
+
// }
|
|
356
|
+
// return dom.outterHTML
|
|
357
|
+
// }
|
|
358
|
+
|
|
348
359
|
|
|
349
360
|
// export function computeStyles(el, properties) {
|
|
350
361
|
// let computed = window.getComputedStyle(el);
|