markdown-flow-ui 0.1.118-dev.1 → 0.1.118-dev.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/dist/_virtual/index.cjs10.js +1 -1
- package/dist/_virtual/index.cjs11.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.es10.js +2 -3
- package/dist/_virtual/index.es10.js.map +1 -1
- package/dist/_virtual/index.es11.js +3 -2
- package/dist/_virtual/index.es11.js.map +1 -1
- package/dist/_virtual/index.es5.js +4 -4
- package/dist/_virtual/index.es6.js +4 -4
- package/dist/components/ContentRender/IframeSandbox.cjs.js +6 -6
- package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.es.js +200 -200
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.cjs.js +12 -11
- package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.es.js +82 -82
- package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.js.map +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.es.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs.js +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs.js.map +1 -1
- package/dist/node_modules/layout-base/layout-base.es.js +1 -1
- package/dist/node_modules/rc-util/es/ref.cjs.js +1 -1
- package/dist/node_modules/rc-util/es/ref.es.js +1 -1
- package/dist/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/node_modules/unified/lib/index.es.js +1 -1
- package/package.json +1 -1
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import j, { useRef as i, useState as
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { inspectViewportHeightFromHtmlRootString as
|
|
7
|
-
import { SANDBOX_INTERACTION_MESSAGE_TYPE as
|
|
8
|
-
import { injectScalingSystem as
|
|
9
|
-
let
|
|
10
|
-
const
|
|
1
|
+
import { j as y } from "../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import j, { useRef as i, useState as C, useCallback as De, useEffect as p, useMemo as Pe } from "react";
|
|
3
|
+
import { createRoot as $e } from "react-dom/client";
|
|
4
|
+
import ze from "./SandboxApp.es.js";
|
|
5
|
+
import qe from "./ContentRender.es.js";
|
|
6
|
+
import { inspectViewportHeightFromHtmlRootString as Ce, EMPTY_ROOT_HEIGHT_META as Ge, parseExplicitHeight as Me, inspectViewportHeightFromNodeChain as Le, resolveExplicitHeightFromNodeChain as Ue } from "./utils/iframe-viewport-height.es.js";
|
|
7
|
+
import { SANDBOX_INTERACTION_MESSAGE_TYPE as Ye, SANDBOX_INTERACTION_MESSAGE_SOURCE as Xe } from "../../lib/sandboxInteraction.es.js";
|
|
8
|
+
import { injectScalingSystem as Ze } from "./utils/iframe-scaling.es.js";
|
|
9
|
+
let ie = null;
|
|
10
|
+
const Je = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
|
|
11
11
|
(c) => c.injectBlackboardLibraries
|
|
12
|
-
)),
|
|
12
|
+
)), ie), Ke = /<img\b[^>]*>/i, Qe = 180, et = 240, tt = (c) => c.split(/\s+/).filter(Boolean).map((o) => {
|
|
13
13
|
const s = o.split(":");
|
|
14
14
|
return s[s.length - 1] !== "h-screen" && s[s.length - 1] !== "min-h-screen" ? o : (s[s.length - 1] = "h-full", s.join(":"));
|
|
15
|
-
}).join(" "),
|
|
15
|
+
}).join(" "), nt = (c, o) => !o || !c.trim() ? c : c.replace(
|
|
16
16
|
/^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
|
|
17
|
-
(s, B,
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
17
|
+
(s, B, M = "") => {
|
|
18
|
+
const m = M.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
|
|
19
|
+
if (!m)
|
|
20
20
|
return s;
|
|
21
|
-
const W =
|
|
22
|
-
return W ===
|
|
23
|
-
|
|
24
|
-
`class=${
|
|
21
|
+
const W = tt(m[2]);
|
|
22
|
+
return W === m[2] ? s : `${B}${M.replace(
|
|
23
|
+
m[0],
|
|
24
|
+
`class=${m[1]}${W}${m[1]}`
|
|
25
25
|
)}>`;
|
|
26
26
|
}
|
|
27
|
-
),
|
|
27
|
+
), ht = ({
|
|
28
28
|
content: c,
|
|
29
29
|
type: o,
|
|
30
30
|
className: s,
|
|
31
31
|
styleLoadingText: B,
|
|
32
|
-
scriptLoadingText:
|
|
33
|
-
fullScreenButtonText:
|
|
32
|
+
scriptLoadingText: M,
|
|
33
|
+
fullScreenButtonText: m,
|
|
34
34
|
hideFullScreen: W = !1,
|
|
35
|
-
mode:
|
|
36
|
-
replaceRootScreenHeightWithFull:
|
|
37
|
-
enableScaling:
|
|
38
|
-
disableLoadingOverlay:
|
|
35
|
+
mode: a = "content",
|
|
36
|
+
replaceRootScreenHeightWithFull: Te = !1,
|
|
37
|
+
enableScaling: Ae = !1,
|
|
38
|
+
disableLoadingOverlay: se = !1
|
|
39
39
|
}) => {
|
|
40
|
-
const D = i(null),
|
|
41
|
-
}), [
|
|
40
|
+
const D = i(null), f = i(null), Y = i(null), T = i(() => {
|
|
41
|
+
}), [ke, _e] = C(480), [ce, Fe] = C(0), [X, le] = C(0), Z = i(!1), J = i(!1), ae = i(0), [ue, Ie] = C(0), [K, Ne] = C(!1), Oe = o === "sandbox", g = a === "blackboard", H = Ae && g && o === "sandbox", A = g && o === "sandbox", R = A && Te, Q = i(""), P = j.useMemo(
|
|
42
42
|
() => o === "sandbox" ? c : "",
|
|
43
43
|
[c, o]
|
|
44
44
|
), n = j.useMemo(
|
|
45
|
-
() =>
|
|
45
|
+
() => nt(
|
|
46
46
|
P,
|
|
47
47
|
R
|
|
48
48
|
),
|
|
49
49
|
[P, R]
|
|
50
|
-
), ue = j.useMemo(
|
|
51
|
-
() => R ? ye(P) : qe,
|
|
52
|
-
[P, R]
|
|
53
50
|
), he = j.useMemo(
|
|
54
|
-
() => R
|
|
51
|
+
() => R ? Ce(P) : Ge,
|
|
52
|
+
[P, R]
|
|
53
|
+
), de = j.useMemo(
|
|
54
|
+
() => R && he.hasFullViewportHeight,
|
|
55
55
|
[
|
|
56
|
-
|
|
56
|
+
he.hasFullViewportHeight,
|
|
57
57
|
R
|
|
58
58
|
]
|
|
59
|
-
), [$,
|
|
59
|
+
), [$, me] = C(
|
|
60
60
|
n
|
|
61
|
-
),
|
|
61
|
+
), fe = i(n), ee = i(n), k = i(null), _ = i(null), ge = i(null), be = De((t) => {
|
|
62
62
|
if (typeof window > "u")
|
|
63
63
|
return;
|
|
64
64
|
const e = Date.now();
|
|
65
|
-
e -
|
|
65
|
+
e - ae.current < et || (ae.current = e, window.postMessage(
|
|
66
66
|
{
|
|
67
|
-
source:
|
|
68
|
-
type:
|
|
67
|
+
source: Xe,
|
|
68
|
+
type: Ye,
|
|
69
69
|
eventType: t
|
|
70
70
|
},
|
|
71
71
|
window.location.origin
|
|
72
72
|
));
|
|
73
|
-
}, []),
|
|
73
|
+
}, []), te = () => {
|
|
74
74
|
k.current !== null && (window.clearTimeout(k.current), k.current = null);
|
|
75
|
-
},
|
|
76
|
-
|
|
75
|
+
}, Ve = () => {
|
|
76
|
+
_.current !== null && (window.cancelAnimationFrame(_.current), _.current = null);
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
p(
|
|
79
79
|
() => () => {
|
|
80
|
-
|
|
80
|
+
te(), Ve();
|
|
81
81
|
},
|
|
82
82
|
[]
|
|
83
|
-
),
|
|
84
|
-
const t =
|
|
85
|
-
|
|
86
|
-
const e = !!t && n.length > t.length && n.startsWith(t),
|
|
83
|
+
), p(() => {
|
|
84
|
+
const t = fe.current;
|
|
85
|
+
fe.current = n;
|
|
86
|
+
const e = !!t && n.length > t.length && n.startsWith(t), u = Ke.test(
|
|
87
87
|
n
|
|
88
88
|
);
|
|
89
|
-
if (!(e &&
|
|
90
|
-
|
|
89
|
+
if (!(e && u)) {
|
|
90
|
+
te(), ee.current = n, me(n);
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
93
|
+
ee.current = n, te(), k.current = window.setTimeout(() => {
|
|
94
|
+
me(ee.current), k.current = null;
|
|
95
|
+
}, Qe);
|
|
96
96
|
}, [n]);
|
|
97
|
-
const z = j.useMemo(() =>
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const z = j.useMemo(() => A ? Ce($).viewportHeightCss : null, [$, A]);
|
|
98
|
+
p(() => {
|
|
99
|
+
ge.current = z;
|
|
100
100
|
}, [z]);
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
101
|
+
const pe = !!z, F = g && o === "sandbox" ? H || de ? "100%" : z ?? `${ke}px` : void 0;
|
|
102
|
+
p(() => {
|
|
103
|
+
if (a !== "blackboard") {
|
|
104
|
+
Q.current = n;
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
|
-
const t =
|
|
108
|
-
!(t && n.startsWith(t)) && t &&
|
|
109
|
-
}, [
|
|
110
|
-
const t =
|
|
107
|
+
const t = Q.current;
|
|
108
|
+
!(t && n.startsWith(t)) && t && Ie((u) => u + 1), Q.current = n;
|
|
109
|
+
}, [a, n]), p(() => {
|
|
110
|
+
const t = f.current;
|
|
111
111
|
if (!t) return;
|
|
112
112
|
const e = t.contentDocument;
|
|
113
113
|
if (!e) return;
|
|
114
114
|
e.open(), e.write(`<!DOCTYPE html>
|
|
115
|
-
<html${
|
|
115
|
+
<html${a === "blackboard" ? ' style="height: 100%;"' : ""}>
|
|
116
116
|
<head>
|
|
117
117
|
<meta charset="utf-8" />
|
|
118
118
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
119
119
|
<style>
|
|
120
120
|
:root { color-scheme: light; }
|
|
121
121
|
html, body, #root { width: 100%; }
|
|
122
|
-
${
|
|
123
|
-
html, body { margin: 0; padding: 0; overflow: ${
|
|
122
|
+
${a === "blackboard" ? "html, body, #root { height: 100%; }" : ""}
|
|
123
|
+
html, body { margin: 0; padding: 0; overflow: ${H ? "hidden auto" : a === "blackboard" ? "auto" : "hidden"}; }
|
|
124
124
|
*, *::before, *::after { box-sizing: border-box; }
|
|
125
|
-
${
|
|
125
|
+
${a !== "blackboard" ? `
|
|
126
126
|
.h-screen { height: auto !important; }
|
|
127
127
|
.min-h-screen { min-height: auto !important; }
|
|
128
128
|
.h-dvh, .h-svh, .h-lvh { height: auto !important; }
|
|
@@ -134,24 +134,24 @@ const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
|
|
|
134
134
|
<div id="root"></div>
|
|
135
135
|
</body>
|
|
136
136
|
</html>`), e.close(), e.documentElement.setAttribute("data-theme", "light"), e.documentElement.style.colorScheme = "light", e.body?.style.setProperty("color-scheme", "light");
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
if (!
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
let
|
|
144
|
-
const
|
|
137
|
+
const u = g && o === "sandbox", q = () => be("click");
|
|
138
|
+
u && e.addEventListener("click", q, !0);
|
|
139
|
+
const I = e.getElementById("root");
|
|
140
|
+
if (!I) return;
|
|
141
|
+
const we = $e(I);
|
|
142
|
+
Y.current = we;
|
|
143
|
+
let N = !1;
|
|
144
|
+
const xe = (r) => ({
|
|
145
145
|
heightAttrValue: r.getAttribute("height"),
|
|
146
146
|
styleAttrValue: r.getAttribute("style"),
|
|
147
147
|
classAttrValue: r.getAttribute("class")
|
|
148
|
-
}),
|
|
149
|
-
const
|
|
150
|
-
return
|
|
151
|
-
},
|
|
152
|
-
if (!
|
|
153
|
-
const r =
|
|
154
|
-
|
|
148
|
+
}), ve = (r) => {
|
|
149
|
+
const w = Array.from(r.children);
|
|
150
|
+
return w.length === 1 ? w[0] : null;
|
|
151
|
+
}, We = () => {
|
|
152
|
+
if (!A || !f.current || !e.body) return null;
|
|
153
|
+
const r = f.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, w = ge.current, G = w ? Me(
|
|
154
|
+
w,
|
|
155
155
|
r
|
|
156
156
|
) : null;
|
|
157
157
|
if (G !== null)
|
|
@@ -160,142 +160,142 @@ const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
|
|
|
160
160
|
".sandbox-wrapper"
|
|
161
161
|
)?.firstElementChild;
|
|
162
162
|
if (!h) return null;
|
|
163
|
-
const
|
|
164
|
-
|
|
163
|
+
const d = Array.from(h.children), x = d.length === 1 ? d[0] : null, L = Le(
|
|
164
|
+
x,
|
|
165
165
|
{
|
|
166
|
-
getNode:
|
|
167
|
-
getSingleChild:
|
|
166
|
+
getNode: xe,
|
|
167
|
+
getSingleChild: ve
|
|
168
168
|
}
|
|
169
169
|
).viewportHeightCss;
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
172
|
-
|
|
170
|
+
if (L) {
|
|
171
|
+
const O = Me(
|
|
172
|
+
L,
|
|
173
173
|
r
|
|
174
174
|
);
|
|
175
|
-
if (
|
|
176
|
-
return Math.ceil(
|
|
175
|
+
if (O !== null)
|
|
176
|
+
return Math.ceil(O);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
179
|
-
|
|
178
|
+
const l = Ue(
|
|
179
|
+
x,
|
|
180
180
|
r,
|
|
181
181
|
{
|
|
182
|
-
getNode:
|
|
183
|
-
getSingleChild:
|
|
182
|
+
getNode: xe,
|
|
183
|
+
getSingleChild: ve
|
|
184
184
|
}
|
|
185
185
|
);
|
|
186
|
-
return
|
|
187
|
-
},
|
|
188
|
-
if (!
|
|
189
|
-
if (!
|
|
190
|
-
if (
|
|
191
|
-
|
|
186
|
+
return l !== null ? Math.ceil(l) : null;
|
|
187
|
+
}, ne = () => {
|
|
188
|
+
if (!f.current || !e.body) return;
|
|
189
|
+
if (!g) {
|
|
190
|
+
if (Z.current) {
|
|
191
|
+
J.current = !0;
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
|
-
|
|
195
|
-
const h =
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
h.style.height =
|
|
199
|
-
let
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
const
|
|
203
|
-
let
|
|
204
|
-
const
|
|
205
|
-
if (E !==
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
Math.ceil(
|
|
194
|
+
Z.current = !0;
|
|
195
|
+
const h = f.current, d = D.current?.clientWidth || 0, x = h.style.height;
|
|
196
|
+
if (d > 0) {
|
|
197
|
+
const oe = Math.round(d * 9 / 16), L = Math.max(8192, d * 20);
|
|
198
|
+
h.style.height = oe + "px", e.body.offsetHeight;
|
|
199
|
+
let l = e.body.scrollHeight;
|
|
200
|
+
const O = e.defaultView;
|
|
201
|
+
if (O) {
|
|
202
|
+
const V = (b) => {
|
|
203
|
+
let v = 0;
|
|
204
|
+
const Se = (E) => {
|
|
205
|
+
if (E !== b && E.scrollHeight > E.clientHeight + 1) {
|
|
206
|
+
const U = O.getComputedStyle(E).overflowY;
|
|
207
|
+
if (U === "auto" || U === "scroll") {
|
|
208
|
+
const ye = E.getBoundingClientRect();
|
|
209
|
+
ye.top >= 0 && (v = Math.max(
|
|
210
|
+
v,
|
|
211
|
+
Math.ceil(ye.top + E.scrollHeight)
|
|
212
212
|
));
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
for (const
|
|
215
|
+
for (const U of E.children) Se(U);
|
|
216
216
|
};
|
|
217
|
-
return
|
|
217
|
+
return Se(b), v;
|
|
218
218
|
};
|
|
219
|
-
|
|
220
|
-
for (let
|
|
221
|
-
h.style.height =
|
|
222
|
-
const
|
|
219
|
+
l = Math.max(l, V(e.body));
|
|
220
|
+
for (let b = 0; b < 8 && l > oe; b++) {
|
|
221
|
+
h.style.height = l + "px", e.body.offsetHeight;
|
|
222
|
+
const v = Math.max(
|
|
223
223
|
e.body.scrollHeight,
|
|
224
|
-
|
|
224
|
+
V(e.body)
|
|
225
225
|
);
|
|
226
|
-
if (
|
|
227
|
-
|
|
226
|
+
if (v <= l + 1 || v >= l * 1.5) break;
|
|
227
|
+
l = v;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
h.style.height =
|
|
231
|
-
const
|
|
232
|
-
return
|
|
230
|
+
h.style.height = x, Fe((V) => {
|
|
231
|
+
const b = Math.min(L, Math.max(200, Math.ceil(l)));
|
|
232
|
+
return V === b ? V : b;
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
setTimeout(() => {
|
|
236
|
-
|
|
236
|
+
Z.current = !1, J.current && (J.current = !1, S());
|
|
237
237
|
}, 50);
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
|
-
if (
|
|
241
|
-
const r = e.body.scrollHeight,
|
|
242
|
-
if (
|
|
243
|
-
const h =
|
|
240
|
+
if (H) return;
|
|
241
|
+
const r = e.body.scrollHeight, w = e.documentElement?.scrollHeight || 0, G = I?.scrollHeight || 0, Re = Math.max(r, w, G);
|
|
242
|
+
if (A) {
|
|
243
|
+
const h = We(), d = Math.max(
|
|
244
244
|
200,
|
|
245
|
-
h ?? Math.ceil(
|
|
245
|
+
h ?? Math.ceil(Re)
|
|
246
246
|
);
|
|
247
247
|
_e(
|
|
248
|
-
(
|
|
248
|
+
(x) => x === d ? x : d
|
|
249
249
|
);
|
|
250
250
|
}
|
|
251
251
|
}, S = () => {
|
|
252
252
|
requestAnimationFrame(() => {
|
|
253
|
-
|
|
253
|
+
N || ne();
|
|
254
254
|
});
|
|
255
255
|
};
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
T.current = S, ne(), S(), Oe && Je().then((r) => {
|
|
257
|
+
N || (r(e), H && Ze(e), requestAnimationFrame(() => {
|
|
258
|
+
N || S();
|
|
259
259
|
}));
|
|
260
260
|
}).catch(() => {
|
|
261
|
-
|
|
261
|
+
N || S();
|
|
262
262
|
});
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
const
|
|
263
|
+
const re = new ResizeObserver(() => ne());
|
|
264
|
+
re.observe(e.body), I && re.observe(I);
|
|
265
|
+
const Ee = new MutationObserver(() => {
|
|
266
266
|
S();
|
|
267
267
|
});
|
|
268
|
-
return
|
|
268
|
+
return Ee.observe(e.body, {
|
|
269
269
|
childList: !0,
|
|
270
270
|
subtree: !0,
|
|
271
271
|
attributes: !0,
|
|
272
272
|
attributeFilter: ["style", "class"]
|
|
273
273
|
}), () => {
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
N = !0, re.disconnect(), Ee.disconnect(), H && t.contentWindow?.__mdf_cleanupScaling?.(), u && e.removeEventListener("click", q, !0), setTimeout(() => {
|
|
275
|
+
we.unmount(), Y.current = null, T.current = () => {
|
|
276
276
|
};
|
|
277
277
|
}, 0);
|
|
278
278
|
};
|
|
279
|
-
}, []),
|
|
279
|
+
}, []), p(() => {
|
|
280
280
|
const t = () => {
|
|
281
|
-
|
|
281
|
+
Ne(!!document.fullscreenElement);
|
|
282
282
|
};
|
|
283
283
|
return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
|
|
284
|
-
}, []),
|
|
284
|
+
}, []), p(() => {
|
|
285
285
|
const t = D.current;
|
|
286
286
|
if (!t) return;
|
|
287
|
-
const e = new ResizeObserver((
|
|
288
|
-
|
|
287
|
+
const e = new ResizeObserver((u) => {
|
|
288
|
+
le(u[0]?.contentRect.width ?? t.clientWidth);
|
|
289
289
|
});
|
|
290
|
-
return e.observe(t),
|
|
290
|
+
return e.observe(t), le(t.clientWidth), () => e.disconnect();
|
|
291
291
|
}, []);
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
292
|
+
const He = Pe(() => {
|
|
293
|
+
if (g || X === 0 || K)
|
|
294
294
|
return;
|
|
295
|
-
const t = Math.round(
|
|
296
|
-
return { height: Math.max(t,
|
|
297
|
-
}, [
|
|
298
|
-
const t = D.current ||
|
|
295
|
+
const t = Math.round(X * 9 / 16);
|
|
296
|
+
return { height: Math.max(t, ce) };
|
|
297
|
+
}, [g, X, ce, K]), je = () => {
|
|
298
|
+
const t = D.current || f.current;
|
|
299
299
|
if (t) {
|
|
300
300
|
if (document.fullscreenElement) {
|
|
301
301
|
document.exitFullscreen().catch(() => {
|
|
@@ -306,79 +306,79 @@ const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
|
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
|
-
|
|
310
|
-
const t =
|
|
309
|
+
p(() => {
|
|
310
|
+
const t = Y.current;
|
|
311
311
|
if (!t) return;
|
|
312
312
|
t.render(
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
|
|
313
|
+
/* @__PURE__ */ y.jsx(
|
|
314
|
+
ze,
|
|
315
315
|
{
|
|
316
316
|
html: $,
|
|
317
317
|
styleLoadingText: B,
|
|
318
|
-
scriptLoadingText:
|
|
319
|
-
disableLoadingOverlay:
|
|
320
|
-
resetToken:
|
|
321
|
-
hasRootVhHeight:
|
|
322
|
-
mode:
|
|
323
|
-
stretchRootHeight:
|
|
324
|
-
enableScaling:
|
|
318
|
+
scriptLoadingText: M,
|
|
319
|
+
disableLoadingOverlay: se,
|
|
320
|
+
resetToken: ue,
|
|
321
|
+
hasRootVhHeight: pe,
|
|
322
|
+
mode: a,
|
|
323
|
+
stretchRootHeight: de,
|
|
324
|
+
enableScaling: H
|
|
325
325
|
}
|
|
326
326
|
)
|
|
327
|
-
),
|
|
328
|
-
|
|
327
|
+
), _.current = window.requestAnimationFrame(() => {
|
|
328
|
+
T.current?.(), H && f.current?.contentWindow?.__mdf_triggerFitContent?.(), _.current = null;
|
|
329
329
|
});
|
|
330
|
-
const e = setTimeout(() =>
|
|
330
|
+
const e = setTimeout(() => T.current?.(), 100), u = setTimeout(() => T.current?.(), 500);
|
|
331
331
|
return () => {
|
|
332
|
-
clearTimeout(e), clearTimeout(
|
|
332
|
+
clearTimeout(e), clearTimeout(u);
|
|
333
333
|
};
|
|
334
334
|
}, [
|
|
335
335
|
$,
|
|
336
336
|
B,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
M,
|
|
338
|
+
ue,
|
|
339
|
+
a
|
|
340
340
|
]);
|
|
341
|
-
const
|
|
341
|
+
const Be = [
|
|
342
342
|
"w-full relative content-render-iframe-sandbox",
|
|
343
|
-
|
|
343
|
+
g ? "h-full overflow-auto flex flex-col" : He ? "overflow-hidden flex items-center justify-center" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
|
|
344
344
|
].filter(Boolean).join(" ");
|
|
345
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ y.jsxs(
|
|
346
346
|
"div",
|
|
347
347
|
{
|
|
348
348
|
ref: D,
|
|
349
|
-
"data-root-vh":
|
|
350
|
-
className:
|
|
351
|
-
style:
|
|
352
|
-
height:
|
|
353
|
-
minHeight:
|
|
354
|
-
} :
|
|
349
|
+
"data-root-vh": pe ? "true" : "false",
|
|
350
|
+
className: Be,
|
|
351
|
+
style: F ? {
|
|
352
|
+
height: F,
|
|
353
|
+
minHeight: F
|
|
354
|
+
} : He,
|
|
355
355
|
children: [
|
|
356
|
-
!W && /* @__PURE__ */
|
|
356
|
+
!W && /* @__PURE__ */ y.jsx(
|
|
357
357
|
"button",
|
|
358
358
|
{
|
|
359
359
|
type: "button",
|
|
360
|
-
onClick:
|
|
360
|
+
onClick: je,
|
|
361
361
|
className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
|
|
362
|
-
children:
|
|
362
|
+
children: K ? "退出全屏" : m || "全屏浏览"
|
|
363
363
|
}
|
|
364
364
|
),
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
a === "blackboard" && o === "markdown" ? /* @__PURE__ */ y.jsx("div", { onClick: () => be("click"), children: /* @__PURE__ */ y.jsx(
|
|
366
|
+
qe,
|
|
367
367
|
{
|
|
368
368
|
content: c,
|
|
369
|
-
disableSandboxLoadingOverlay:
|
|
369
|
+
disableSandboxLoadingOverlay: se
|
|
370
370
|
}
|
|
371
|
-
) }) : /* @__PURE__ */
|
|
371
|
+
) }) : /* @__PURE__ */ y.jsx(
|
|
372
372
|
"iframe",
|
|
373
373
|
{
|
|
374
|
-
ref:
|
|
374
|
+
ref: f,
|
|
375
375
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
376
376
|
allow: "fullscreen",
|
|
377
377
|
allowFullScreen: !0,
|
|
378
378
|
className: [s, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
379
379
|
style: {
|
|
380
|
-
height:
|
|
381
|
-
minHeight:
|
|
380
|
+
height: F ?? "100%",
|
|
381
|
+
minHeight: F,
|
|
382
382
|
margin: "auto"
|
|
383
383
|
}
|
|
384
384
|
}
|
|
@@ -388,6 +388,6 @@ const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
|
|
|
388
388
|
);
|
|
389
389
|
};
|
|
390
390
|
export {
|
|
391
|
-
|
|
391
|
+
ht as default
|
|
392
392
|
};
|
|
393
393
|
//# sourceMappingURL=IframeSandbox.es.js.map
|