@zzdadelu/schema-builder 1.0.0-alpha.113 → 1.0.0-alpha.116
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/es/main.js +25 -10
- package/lib/main.js +25 -10
- package/package.json +1 -1
package/es/main.js
CHANGED
|
@@ -40,22 +40,37 @@ var Design = function Design(props, ref) {
|
|
|
40
40
|
containerRef.current.appendChild(iframe);
|
|
41
41
|
};
|
|
42
42
|
var engineOnLoad = function engineOnLoad(event) {
|
|
43
|
-
var _iframe3,
|
|
43
|
+
var _iframe3, _outerIframeWindow$__;
|
|
44
44
|
if (event.data.type !== 'engine-load') {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
+
var outerIframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
|
|
48
|
+
if (!outerIframeWindow) return;
|
|
47
49
|
|
|
48
|
-
//
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
// 尝试监听外层 iframe 内部文档的变化
|
|
51
|
+
var innerDoc = outerIframeWindow.document;
|
|
52
|
+
if (!innerDoc) return;
|
|
53
|
+
|
|
54
|
+
// 创建一个 MutationObserver 来监听外层 iframe 内部 iframe 的创建
|
|
55
|
+
var innerObserver = new MutationObserver(function (mutations) {
|
|
56
|
+
console.log('检测到内层 iframe 被添加......');
|
|
57
|
+
mutations.forEach(function (mutation) {
|
|
58
|
+
mutation.addedNodes.forEach(function (node) {
|
|
59
|
+
console.log('检测到内层 iframe 被添加', node);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// 开始观察外层 iframe 内部 body 的变化
|
|
65
|
+
innerObserver.observe(innerDoc.body, {
|
|
66
|
+
childList: true,
|
|
67
|
+
subtree: true
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// 初始化 __FR_ENGINE__
|
|
71
|
+
(_outerIframeWindow$__ = outerIframeWindow.__FR_ENGINE__) === null || _outerIframeWindow$__ === void 0 ? void 0 : _outerIframeWindow$__.init(_objectSpread({
|
|
56
72
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
57
73
|
widgets: widgets,
|
|
58
|
-
// recordEnable: true,
|
|
59
74
|
logo: {
|
|
60
75
|
title: 'XRender'
|
|
61
76
|
}
|
package/lib/main.js
CHANGED
|
@@ -48,22 +48,37 @@ var Design = function Design(props, ref) {
|
|
|
48
48
|
containerRef.current.appendChild(iframe);
|
|
49
49
|
};
|
|
50
50
|
var engineOnLoad = function engineOnLoad(event) {
|
|
51
|
-
var _iframe3,
|
|
51
|
+
var _iframe3, _outerIframeWindow$__;
|
|
52
52
|
if (event.data.type !== 'engine-load') {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
+
var outerIframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
|
|
56
|
+
if (!outerIframeWindow) return;
|
|
55
57
|
|
|
56
|
-
//
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
// 尝试监听外层 iframe 内部文档的变化
|
|
59
|
+
var innerDoc = outerIframeWindow.document;
|
|
60
|
+
if (!innerDoc) return;
|
|
61
|
+
|
|
62
|
+
// 创建一个 MutationObserver 来监听外层 iframe 内部 iframe 的创建
|
|
63
|
+
var innerObserver = new MutationObserver(function (mutations) {
|
|
64
|
+
console.log('检测到内层 iframe 被添加......');
|
|
65
|
+
mutations.forEach(function (mutation) {
|
|
66
|
+
mutation.addedNodes.forEach(function (node) {
|
|
67
|
+
console.log('检测到内层 iframe 被添加', node);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// 开始观察外层 iframe 内部 body 的变化
|
|
73
|
+
innerObserver.observe(innerDoc.body, {
|
|
74
|
+
childList: true,
|
|
75
|
+
subtree: true
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// 初始化 __FR_ENGINE__
|
|
79
|
+
(_outerIframeWindow$__ = outerIframeWindow.__FR_ENGINE__) === null || _outerIframeWindow$__ === void 0 ? void 0 : _outerIframeWindow$__.init(_objectSpread({
|
|
64
80
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
65
81
|
widgets: widgets,
|
|
66
|
-
// recordEnable: true,
|
|
67
82
|
logo: {
|
|
68
83
|
title: 'XRender'
|
|
69
84
|
}
|