@cocreate/utils 1.17.20 → 1.17.22

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,17 @@
1
+ ## [1.17.22](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.17.21...v1.17.22) (2023-01-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump dependencies ([f310a55](https://github.com/CoCreate-app/CoCreate-utils/commit/f310a55935915f70964ff7df808844efe88b6a7f))
7
+
8
+ ## [1.17.21](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.17.20...v1.17.21) (2023-01-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * try to access window.top if fails continue ([c2bd8e6](https://github.com/CoCreate-app/CoCreate-utils/commit/c2bd8e6275ebb6450ffdac7a7d40ffd7837a87bc))
14
+
1
15
  ## [1.17.20](https://github.com/CoCreate-app/CoCreate-utils/compare/v1.17.19...v1.17.20) (2023-01-10)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/utils",
3
- "version": "1.17.20",
3
+ "version": "1.17.22",
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",
@@ -60,6 +60,6 @@
60
60
  "webpack-log": "^3.0.1"
61
61
  },
62
62
  "dependencies": {
63
- "@cocreate/docs": "^1.5.6"
63
+ "@cocreate/docs": "^1.5.8"
64
64
  }
65
65
  }
package/src/utils.js CHANGED
@@ -15,21 +15,28 @@
15
15
  document.addEventListener('click', e => {
16
16
  document.clickedElement = e.target;
17
17
  });
18
- let frameDocuments = window.top.frameDocuments;
19
- if (!frameDocuments){
20
- window.top.frameDocuments = new Map();
21
- frameDocuments = window.top.frameDocuments;
22
- }
23
- let frames = document.querySelectorAll('iframe');
24
- for (let frame of frames){
25
- let frameDocument = frame.contentDocument;
26
- if (!frameDocuments.has(frameDocument)){
27
- frameDocuments.set(frameDocument, '')
28
- frameDocument.addEventListener('click', e => {
29
- frameDocument.clickedElement = e.target;
30
- });
18
+
19
+ try {
20
+ let frameDocuments = window.top.frameDocuments;
21
+ if (!frameDocuments){
22
+ window.top.frameDocuments = new Map();
23
+ frameDocuments = window.top.frameDocuments;
31
24
  }
32
- }
25
+ let frames = document.querySelectorAll('iframe');
26
+ for (let frame of frames){
27
+ let frameDocument = frame.contentDocument;
28
+ if (!frameDocuments.has(frameDocument)){
29
+ frameDocuments.set(frameDocument, '')
30
+ frameDocument.addEventListener('click', e => {
31
+ frameDocument.clickedElement = e.target;
32
+ });
33
+ }
34
+ }
35
+
36
+ } catch (e) {
37
+ console.log('cross-origin failed')
38
+ }
39
+
33
40
  }
34
41
 
35
42
  const ObjectId = (rnd = r16 => Math.floor(r16).toString(16)) =>