react-iframe-plugin 0.0.15 → 0.0.16
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/dist/IframePlugin.d.ts +7 -0
- package/dist/IframePlugin.es.js +52 -14
- package/package.json +1 -1
package/dist/IframePlugin.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ interface IframePluginProps {
|
|
|
4
4
|
title: string;
|
|
5
5
|
width: string;
|
|
6
6
|
height: string;
|
|
7
|
+
types: string;
|
|
8
|
+
currentDomain: string;
|
|
9
|
+
iframeDomain: string;
|
|
10
|
+
basicHeight: string;
|
|
11
|
+
url: string;
|
|
12
|
+
newWindow: boolean;
|
|
13
|
+
footerHeight: string;
|
|
7
14
|
}
|
|
8
15
|
declare const IframePlugin: React.FC<IframePluginProps>;
|
|
9
16
|
export default IframePlugin;
|
package/dist/IframePlugin.es.js
CHANGED
|
@@ -1,16 +1,54 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as n, Fragment as w, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useEffect as y } from "react";
|
|
3
|
+
const v = (g) => {
|
|
4
|
+
const [l, s] = x(""), { footerHeight: f, newWindow: d, url: h, basicHeight: t, iframeDomain: r, currentDomain: e, types: p, src: c, title: m, width: u, height: o } = g;
|
|
5
|
+
return y(
|
|
6
|
+
() => {
|
|
7
|
+
const a = document.getElementById("iframePlugin");
|
|
8
|
+
console.log(87878787, a.contentWindow, e, r, h, o, t, d), a.addEventListener("load", function() {
|
|
9
|
+
console.log("currentDomain────────────", e, t), s(t || "250px"), e && a.contentWindow.postMessage(
|
|
10
|
+
{
|
|
11
|
+
currentDomain: e || "http://localhost:8081",
|
|
12
|
+
iframeDomain: r || "http://localhost:8086",
|
|
13
|
+
url: h || "http://localhost:8081",
|
|
14
|
+
height: o || "800px",
|
|
15
|
+
basicHeight: t,
|
|
16
|
+
newWindow: d || !0
|
|
17
|
+
},
|
|
18
|
+
r || "http://localhost:8086"
|
|
19
|
+
);
|
|
20
|
+
}), window.addEventListener("message", function(i) {
|
|
21
|
+
console.log(123123123123, i), console.log("Fetch iframe:", i.data.height), i.data && s(i.data.height);
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
[]
|
|
25
|
+
), /* @__PURE__ */ n(w, { children: /* @__PURE__ */ b("div", { style: { width: "100%", position: "relative", paddingBottom: "250px" }, children: [
|
|
26
|
+
/* @__PURE__ */ n("div", { style: { position: "absolute", left: "30%", top: 0, color: "white" }, children: l }),
|
|
27
|
+
p === "footer" ? /* @__PURE__ */ n(
|
|
28
|
+
"iframe",
|
|
29
|
+
{
|
|
30
|
+
id: "iframeFooter",
|
|
31
|
+
src: c,
|
|
32
|
+
title: m,
|
|
33
|
+
width: u,
|
|
34
|
+
height: o,
|
|
35
|
+
style: { border: "none", height: f, width: "100vw", background: "transparent", position: "absolute" },
|
|
36
|
+
allowFullScreen: !0
|
|
37
|
+
}
|
|
38
|
+
) : /* @__PURE__ */ n(
|
|
39
|
+
"iframe",
|
|
40
|
+
{
|
|
41
|
+
id: "iframePlugin",
|
|
42
|
+
src: c,
|
|
43
|
+
title: m,
|
|
44
|
+
width: u,
|
|
45
|
+
height: o,
|
|
46
|
+
style: { border: "none", height: l, width: "100vw", background: "transparent", position: "absolute" },
|
|
47
|
+
allowFullScreen: !0
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }) });
|
|
51
|
+
};
|
|
14
52
|
export {
|
|
15
|
-
|
|
53
|
+
v as default
|
|
16
54
|
};
|