@zzdadelu/schema-builder 1.0.0-alpha.37 → 1.0.0-alpha.39

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.
Files changed (3) hide show
  1. package/es/main.js +1 -51
  2. package/lib/main.js +1 -51
  3. package/package.json +1 -1
package/es/main.js CHANGED
@@ -30,33 +30,6 @@ var Design = function Design(props, ref) {
30
30
  }
31
31
  };
32
32
  });
33
- var modifyIframeContent = function modifyIframeContent() {
34
- var iframe = document.getElementsByTagName("iframe")[0];
35
- if (iframe) {
36
- var iframeDoc = iframe.contentDocument;
37
- console.log('modifyIframe iframeDoc', iframeDoc);
38
- if (iframeDoc) {
39
- var iframe2 = iframeDoc === null || iframeDoc === void 0 ? void 0 : iframeDoc.getElementsByTagName("iframe")[0];
40
- var iframeDoc2 = iframe2 === null || iframe2 === void 0 ? void 0 : iframe2.contentDocument;
41
- console.log('modifyIframe iframeDoc2', iframeDoc2);
42
- if (iframeDoc2) {
43
- // Find and replace the target script
44
- var scripts = iframeDoc2.querySelectorAll('script');
45
- var targetScript = Array.from(scripts).find(function (script) {
46
- return script.src === 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js';
47
- });
48
- if (targetScript) {
49
- targetScript.remove();
50
-
51
- // Create new script with timestamp
52
- var newScript = iframeDoc2.createElement('script');
53
- newScript.src = 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js?t=' + new Date().getTime();
54
- iframeDoc2.body.appendChild(newScript);
55
- }
56
- }
57
- }
58
- }
59
- };
60
33
  useEffect(function () {
61
34
  initIframe();
62
35
  window.addEventListener('message', engineOnLoad);
@@ -68,6 +41,7 @@ var Design = function Design(props, ref) {
68
41
  console.log("开始创建 iframe");
69
42
  iframe = createIframe();
70
43
  containerRef.current.appendChild(iframe);
44
+ console.log("iframe 创建完成:", containerRef, iframe);
71
45
  };
72
46
  var engineOnLoad = function engineOnLoad(event) {
73
47
  var _iframe5, _iframe5$contentWindo, _iframe5$contentWindo2;
@@ -83,30 +57,6 @@ var Design = function Design(props, ref) {
83
57
  title: 'XRender'
84
58
  }
85
59
  }, restProps));
86
- iframe.onload = function () {
87
- console.log('XRender iframe', iframe);
88
- var iframeDoc = iframe.contentDocument;
89
- console.log(' XRender modifyIframe iframeDoc', iframeDoc);
90
- if (iframeDoc) {
91
- var iframe2 = iframeDoc === null || iframeDoc === void 0 ? void 0 : iframeDoc.getElementsByTagName("iframe")[0];
92
- var iframeDoc2 = iframe2 === null || iframe2 === void 0 ? void 0 : iframe2.contentDocument;
93
- console.log(' XRender modifyIframe iframeDoc2', iframeDoc2);
94
- if (iframeDoc2) {
95
- // Find and replace the target script
96
- var scripts = iframeDoc2.querySelectorAll('script');
97
- var targetScript = Array.from(scripts).find(function (script) {
98
- return script.src === 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js';
99
- });
100
- if (targetScript) {
101
- targetScript.remove();
102
- // Create new script with timestamp
103
- var newScript = iframeDoc2.createElement('script');
104
- newScript.src = 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js?t=' + new Date().getTime();
105
- iframeDoc2.body.appendChild(newScript);
106
- }
107
- }
108
- }
109
- };
110
60
  };
111
61
  return /*#__PURE__*/React.createElement("div", {
112
62
  ref: containerRef,
package/lib/main.js CHANGED
@@ -38,33 +38,6 @@ var Design = function Design(props, ref) {
38
38
  }
39
39
  };
40
40
  });
41
- var modifyIframeContent = function modifyIframeContent() {
42
- var iframe = document.getElementsByTagName("iframe")[0];
43
- if (iframe) {
44
- var iframeDoc = iframe.contentDocument;
45
- console.log('modifyIframe iframeDoc', iframeDoc);
46
- if (iframeDoc) {
47
- var iframe2 = iframeDoc === null || iframeDoc === void 0 ? void 0 : iframeDoc.getElementsByTagName("iframe")[0];
48
- var iframeDoc2 = iframe2 === null || iframe2 === void 0 ? void 0 : iframe2.contentDocument;
49
- console.log('modifyIframe iframeDoc2', iframeDoc2);
50
- if (iframeDoc2) {
51
- // Find and replace the target script
52
- var scripts = iframeDoc2.querySelectorAll('script');
53
- var targetScript = Array.from(scripts).find(function (script) {
54
- return script.src === 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js';
55
- });
56
- if (targetScript) {
57
- targetScript.remove();
58
-
59
- // Create new script with timestamp
60
- var newScript = iframeDoc2.createElement('script');
61
- newScript.src = 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js?t=' + new Date().getTime();
62
- iframeDoc2.body.appendChild(newScript);
63
- }
64
- }
65
- }
66
- }
67
- };
68
41
  (0, _react.useEffect)(function () {
69
42
  initIframe();
70
43
  window.addEventListener('message', engineOnLoad);
@@ -76,6 +49,7 @@ var Design = function Design(props, ref) {
76
49
  console.log("开始创建 iframe");
77
50
  iframe = (0, _createIframe.default)();
78
51
  containerRef.current.appendChild(iframe);
52
+ console.log("iframe 创建完成:", containerRef, iframe);
79
53
  };
80
54
  var engineOnLoad = function engineOnLoad(event) {
81
55
  var _iframe5, _iframe5$contentWindo, _iframe5$contentWindo2;
@@ -91,30 +65,6 @@ var Design = function Design(props, ref) {
91
65
  title: 'XRender'
92
66
  }
93
67
  }, restProps));
94
- iframe.onload = function () {
95
- console.log('XRender iframe', iframe);
96
- var iframeDoc = iframe.contentDocument;
97
- console.log(' XRender modifyIframe iframeDoc', iframeDoc);
98
- if (iframeDoc) {
99
- var iframe2 = iframeDoc === null || iframeDoc === void 0 ? void 0 : iframeDoc.getElementsByTagName("iframe")[0];
100
- var iframeDoc2 = iframe2 === null || iframe2 === void 0 ? void 0 : iframe2.contentDocument;
101
- console.log(' XRender modifyIframe iframeDoc2', iframeDoc2);
102
- if (iframeDoc2) {
103
- // Find and replace the target script
104
- var scripts = iframeDoc2.querySelectorAll('script');
105
- var targetScript = Array.from(scripts).find(function (script) {
106
- return script.src === 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js';
107
- });
108
- if (targetScript) {
109
- targetScript.remove();
110
- // Create new script with timestamp
111
- var newScript = iframeDoc2.createElement('script');
112
- newScript.src = 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@latest/dist/js/react-simulator-renderer.js?t=' + new Date().getTime();
113
- iframeDoc2.body.appendChild(newScript);
114
- }
115
- }
116
- }
117
- };
118
68
  };
119
69
  return /*#__PURE__*/_react.default.createElement("div", {
120
70
  ref: containerRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.37",
3
+ "version": "1.0.0-alpha.39",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",