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