markdown-flow-ui 0.3.9 → 0.3.11
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/index8.cjs +1 -1
- package/dist/_virtual/index8.es.js +2 -2
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/_virtual/index9.es.js +2 -2
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/ContentRender/ContentRender.cjs +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
- package/dist/components/ContentRender/ContentRender.d.ts +2 -0
- package/dist/components/ContentRender/ContentRender.es.js +365 -361
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs +4 -4
- package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.d.ts +2 -0
- package/dist/components/ContentRender/IframeSandbox.es.js +286 -287
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.cjs +2 -2
- package/dist/components/ContentRender/SandboxApp.cjs.map +1 -1
- package/dist/components/ContentRender/SandboxApp.d.ts +3 -2
- package/dist/components/ContentRender/SandboxApp.es.js +136 -116
- package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
- package/dist/components/ContentRender/locales/contentRender.json.cjs +1 -1
- package/dist/components/ContentRender/locales/contentRender.json.d.ts +11 -11
- package/dist/components/ContentRender/locales/contentRender.json.es.js +11 -11
- package/dist/components/Slide/Player.cjs +1 -1
- package/dist/components/Slide/Player.cjs.map +1 -1
- package/dist/components/Slide/Player.es.js +319 -321
- package/dist/components/Slide/Player.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs +1 -1
- package/dist/components/Slide/Slide.cjs.map +1 -1
- package/dist/components/Slide/Slide.es.js +446 -452
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/useWakePlayerFromIframe.cjs +1 -1
- package/dist/components/Slide/useWakePlayerFromIframe.cjs.map +1 -1
- package/dist/components/Slide/useWakePlayerFromIframe.es.js +32 -32
- package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.map +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +2 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +71 -25
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
- package/dist/markdown-flow-ui.css +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/classnames/index.cjs +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/package.json +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs +0 -2
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js +0 -20
- package/dist/node_modules/lucide-react/dist/esm/icons/grip-horizontal.es.js.map +0 -1
|
@@ -1,147 +1,142 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import
|
|
5
|
-
import { normalizeContentViewportMinHeight as
|
|
6
|
-
import
|
|
7
|
-
import { EMPTY_ROOT_HEIGHT_META as
|
|
8
|
-
import { SANDBOX_INTERACTION_MESSAGE_TYPE as
|
|
9
|
-
import { injectScalingSystem as
|
|
10
|
-
import { getMarkdownFlowDirection as
|
|
11
|
-
import { useDetachedLanguage as
|
|
1
|
+
import { jsx as V, jsxs as kt } from "react/jsx-runtime";
|
|
2
|
+
import G, { useRef as i, useCallback as tt, useState as A, useEffect as H, useMemo as At } from "react";
|
|
3
|
+
import { createRoot as Ft } from "react-dom/client";
|
|
4
|
+
import _t from "./SandboxApp.es.js";
|
|
5
|
+
import { normalizeContentViewportMinHeight as Dt } from "./utils/content-viewport-min-height.es.js";
|
|
6
|
+
import It from "./ContentRender.es.js";
|
|
7
|
+
import { EMPTY_ROOT_HEIGHT_META as Ot, inspectViewportHeightFromHtmlRootString as nt, parseExplicitHeight as rt, inspectViewportHeightFromNodeChain as Nt, resolveExplicitHeightFromNodeChain as Vt } from "./utils/iframe-viewport-height.es.js";
|
|
8
|
+
import { SANDBOX_INTERACTION_MESSAGE_TYPE as Bt, SANDBOX_INTERACTION_MESSAGE_SOURCE as Wt } from "../../lib/sandboxInteraction.es.js";
|
|
9
|
+
import { injectScalingSystem as zt } from "./utils/iframe-scaling.es.js";
|
|
10
|
+
import { getMarkdownFlowDirection as $t, getMarkdownFlowLanguage as Pt } from "../../lib/locale.es.js";
|
|
11
|
+
import { useDetachedLanguage as qt } from "../../lib/useDetachedLanguage.es.js";
|
|
12
12
|
import { useResolvedDirection as ot } from "../../lib/useResolvedDirection.es.js";
|
|
13
|
-
import { getContentRenderLocaleTexts as
|
|
14
|
-
import { CJK_SAFE_SANS_FONT_FAMILY as
|
|
15
|
-
let
|
|
16
|
-
const it = () => (
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
}).join(" "),
|
|
13
|
+
import { getContentRenderLocaleTexts as Lt } from "./contentRenderI18n.es.js";
|
|
14
|
+
import { CJK_SAFE_SANS_FONT_FAMILY as jt } from "./cjkFontFamily.es.js";
|
|
15
|
+
let ye = null;
|
|
16
|
+
const it = () => (ye || (ye = import("./blackboard-vendor.es.js")), ye), ct = /<img\b[^>]*>/i, Gt = 180, Yt = 240, Ut = (c) => c.split(/\s+/).filter(Boolean).map((r) => {
|
|
17
|
+
const l = r.split(":");
|
|
18
|
+
return l[l.length - 1] !== "h-screen" && l[l.length - 1] !== "min-h-screen" ? r : (l[l.length - 1] = "h-full", l.join(":"));
|
|
19
|
+
}).join(" "), Xt = (c, r) => !r || !c.trim() ? c : c.replace(
|
|
20
20
|
/^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
|
|
21
|
-
(
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
return
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
`class=${
|
|
21
|
+
(l, f, Y = "") => {
|
|
22
|
+
const x = Y.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
|
|
23
|
+
if (!x)
|
|
24
|
+
return l;
|
|
25
|
+
const B = Ut(x[2]);
|
|
26
|
+
return B === x[2] ? l : `${f}${Y.replace(
|
|
27
|
+
x[0],
|
|
28
|
+
`class=${x[1]}${B}${x[1]}`
|
|
29
29
|
)}>`;
|
|
30
30
|
}
|
|
31
|
-
),
|
|
32
|
-
content:
|
|
31
|
+
), Kt = ({
|
|
32
|
+
content: c,
|
|
33
33
|
type: r,
|
|
34
|
-
className:
|
|
35
|
-
locale:
|
|
36
|
-
lang:
|
|
37
|
-
dir:
|
|
38
|
-
loadingText:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
className: l,
|
|
35
|
+
locale: f,
|
|
36
|
+
lang: Y,
|
|
37
|
+
dir: x,
|
|
38
|
+
loadingText: B,
|
|
39
|
+
styleLoadingText: Me,
|
|
40
|
+
scriptLoadingText: Ee,
|
|
41
|
+
fullScreenButtonText: st,
|
|
42
|
+
exitFullScreenButtonText: lt,
|
|
43
|
+
hideFullScreen: Te = !1,
|
|
42
44
|
mode: a = "content",
|
|
43
|
-
replaceRootScreenHeightWithFull:
|
|
44
|
-
enableScaling:
|
|
45
|
-
disableLoadingOverlay:
|
|
45
|
+
replaceRootScreenHeightWithFull: at = !1,
|
|
46
|
+
enableScaling: ut = !1,
|
|
47
|
+
disableLoadingOverlay: oe = !1
|
|
46
48
|
}) => {
|
|
47
|
-
const
|
|
49
|
+
const ke = Lt(f), R = x ?? $t(f), ie = Y ?? Pt(f), dt = st || ke.sandboxFullscreenButtonText, ht = lt || ke.sandboxExitFullscreenButtonText, F = i(null), Ae = i(null), Fe = qt(F, ie), { resolvedDirection: ce } = ot(F, R), _e = i(null), De = i(null), ft = tt(
|
|
48
50
|
(t) => {
|
|
49
51
|
_e.current = t, De.current = t?.querySelector(".content-render") ?? null;
|
|
50
52
|
},
|
|
51
53
|
[]
|
|
52
|
-
), { resolvedDirection:
|
|
54
|
+
), { resolvedDirection: mt } = ot(
|
|
53
55
|
De,
|
|
54
|
-
|
|
55
|
-
), Ie =
|
|
56
|
-
|
|
57
|
-
const [
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
const C =
|
|
61
|
-
}), [wt,
|
|
62
|
-
() => r === "sandbox" ?
|
|
63
|
-
[
|
|
64
|
-
),
|
|
65
|
-
() =>
|
|
66
|
-
|
|
56
|
+
R
|
|
57
|
+
), Ie = R ?? ce, Oe = i(R);
|
|
58
|
+
Oe.current = R;
|
|
59
|
+
const [gt, bt] = A();
|
|
60
|
+
let U;
|
|
61
|
+
R === "auto" && (U = ce, r === "sandbox" ? U = gt ?? ce : a === "blackboard" && (U = mt));
|
|
62
|
+
const C = i(null), X = i(null), W = i(() => {
|
|
63
|
+
}), [wt, pt] = A(480), [se, Ht] = A(null), [K, le] = A(0), [Ne, xt] = A(0), ae = i(!1), ue = i(!1), Ve = i(0), [Be, Rt] = A(0), [de, Ct] = A(!1), he = r === "sandbox", v = a === "blackboard", S = ut && v && r === "sandbox", z = v && r === "sandbox", O = z && at, fe = i(""), J = G.useMemo(
|
|
64
|
+
() => r === "sandbox" ? c : "",
|
|
65
|
+
[c, r]
|
|
66
|
+
), o = G.useMemo(
|
|
67
|
+
() => Xt(
|
|
68
|
+
J,
|
|
67
69
|
O
|
|
68
70
|
),
|
|
69
|
-
[
|
|
70
|
-
), We =
|
|
71
|
-
() => O ? nt(
|
|
72
|
-
[
|
|
73
|
-
),
|
|
71
|
+
[J, O]
|
|
72
|
+
), We = G.useMemo(
|
|
73
|
+
() => O ? nt(J) : Ot,
|
|
74
|
+
[J, O]
|
|
75
|
+
), me = G.useMemo(
|
|
74
76
|
() => O && We.hasFullViewportHeight,
|
|
75
77
|
[
|
|
76
78
|
We.hasFullViewportHeight,
|
|
77
79
|
O
|
|
78
80
|
]
|
|
79
|
-
), [
|
|
80
|
-
|
|
81
|
-
),
|
|
81
|
+
), [$, ze] = A(
|
|
82
|
+
o
|
|
83
|
+
), $e = $ !== o && ct.test(o), Pe = i(o), ge = i(o), P = i(null), y = i(null), qe = i(null), be = tt((t) => {
|
|
82
84
|
if (typeof window > "u")
|
|
83
85
|
return;
|
|
84
86
|
const e = Date.now();
|
|
85
|
-
e - Ve.current <
|
|
87
|
+
e - Ve.current < Yt || (Ve.current = e, window.postMessage(
|
|
86
88
|
{
|
|
87
|
-
source:
|
|
88
|
-
type:
|
|
89
|
+
source: Wt,
|
|
90
|
+
type: Bt,
|
|
89
91
|
eventType: t
|
|
90
92
|
},
|
|
91
93
|
window.location.origin
|
|
92
94
|
));
|
|
93
95
|
}, []);
|
|
94
|
-
|
|
96
|
+
H(() => {
|
|
95
97
|
if (r !== "markdown" || a !== "blackboard") return;
|
|
96
98
|
const t = _e.current;
|
|
97
99
|
if (!t) return;
|
|
98
|
-
const e = () =>
|
|
100
|
+
const e = () => be("click");
|
|
99
101
|
return t.addEventListener("click", e), () => t.removeEventListener("click", e);
|
|
100
|
-
}, [
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
}, Ct = () => {
|
|
106
|
-
M.current !== null && (window.cancelAnimationFrame(M.current), M.current = null);
|
|
102
|
+
}, [be, a, r]);
|
|
103
|
+
const we = () => {
|
|
104
|
+
P.current !== null && (window.clearTimeout(P.current), P.current = null);
|
|
105
|
+
}, vt = () => {
|
|
106
|
+
y.current !== null && (window.cancelAnimationFrame(y.current), y.current = null);
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
H(
|
|
109
109
|
() => () => {
|
|
110
|
-
|
|
110
|
+
we(), vt();
|
|
111
111
|
},
|
|
112
112
|
[]
|
|
113
|
-
),
|
|
114
|
-
const t =
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
q.current = null, He(), pe({ html: l.html, deferScripts: !1 });
|
|
122
|
-
}, st)), !(d && ct.test(t))) {
|
|
123
|
-
He(), pe(
|
|
124
|
-
(g) => g.html === l.html && g.deferScripts === l.deferScripts ? g : l
|
|
125
|
-
);
|
|
113
|
+
), H(() => {
|
|
114
|
+
const t = Pe.current;
|
|
115
|
+
Pe.current = o;
|
|
116
|
+
const e = !!t && o.length > t.length && o.startsWith(t), u = ct.test(
|
|
117
|
+
o
|
|
118
|
+
);
|
|
119
|
+
if (!(e && u)) {
|
|
120
|
+
we(), ge.current = o, ze(o);
|
|
126
121
|
return;
|
|
127
122
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
}, [
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}, [
|
|
136
|
-
const
|
|
137
|
-
|
|
123
|
+
ge.current = o, we(), P.current = window.setTimeout(() => {
|
|
124
|
+
ze(ge.current), P.current = null;
|
|
125
|
+
}, Gt);
|
|
126
|
+
}, [o]);
|
|
127
|
+
const Q = G.useMemo(() => z ? nt($).viewportHeightCss : null, [$, z]);
|
|
128
|
+
H(() => {
|
|
129
|
+
qe.current = Q;
|
|
130
|
+
}, [Q]);
|
|
131
|
+
const pe = !!Q, q = v && r === "sandbox" ? S || me ? "100%" : Q ?? `${wt}px` : void 0;
|
|
132
|
+
H(() => {
|
|
138
133
|
if (a !== "blackboard") {
|
|
139
|
-
|
|
134
|
+
fe.current = o;
|
|
140
135
|
return;
|
|
141
136
|
}
|
|
142
|
-
const t =
|
|
143
|
-
!(t &&
|
|
144
|
-
}, [a,
|
|
137
|
+
const t = fe.current;
|
|
138
|
+
!(t && o.startsWith(t)) && t && Rt((u) => u + 1), fe.current = o;
|
|
139
|
+
}, [a, o]), H(() => {
|
|
145
140
|
const t = C.current;
|
|
146
141
|
if (!t) return;
|
|
147
142
|
const e = t.contentDocument;
|
|
@@ -153,9 +148,9 @@ const it = () => (Me || (Me = import("./blackboard-vendor.es.js")), Me), ct = /<
|
|
|
153
148
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
154
149
|
<style>
|
|
155
150
|
:root { color-scheme: light; }
|
|
156
|
-
html, body, #root { width: 100%; font-family: ${
|
|
151
|
+
html, body, #root { width: 100%; font-family: ${jt}; }
|
|
157
152
|
${a === "blackboard" ? "html, body, #root { height: 100%; }" : ""}
|
|
158
|
-
html, body { margin: 0; padding: 0; overflow: ${
|
|
153
|
+
html, body { margin: 0; padding: 0; overflow: ${S ? "hidden auto" : a === "blackboard" ? "auto" : "hidden"}; }
|
|
159
154
|
*, *::before, *::after { box-sizing: border-box; }
|
|
160
155
|
${a !== "blackboard" ? `
|
|
161
156
|
.h-screen { height: auto !important; }
|
|
@@ -169,174 +164,174 @@ const it = () => (Me || (Me = import("./blackboard-vendor.es.js")), Me), ct = /<
|
|
|
169
164
|
<div id="root"></div>
|
|
170
165
|
</body>
|
|
171
166
|
</html>`), e.close(), e.documentElement.setAttribute("data-theme", "light"), e.documentElement.style.colorScheme = "light", e.body?.style.setProperty("color-scheme", "light");
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
if (!
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
let
|
|
179
|
-
const
|
|
167
|
+
const u = v && r === "sandbox", M = () => be("click");
|
|
168
|
+
u && e.addEventListener("click", M, !0);
|
|
169
|
+
const _ = e.getElementById("root");
|
|
170
|
+
if (!_) return;
|
|
171
|
+
const N = Ft(_);
|
|
172
|
+
X.current = N;
|
|
173
|
+
let m = !1;
|
|
174
|
+
const Le = (n) => ({
|
|
180
175
|
heightAttrValue: n.getAttribute("height"),
|
|
181
176
|
styleAttrValue: n.getAttribute("style"),
|
|
182
177
|
classAttrValue: n.getAttribute("class")
|
|
183
178
|
}), je = (n) => {
|
|
184
|
-
const
|
|
185
|
-
return
|
|
179
|
+
const s = Array.from(n.children);
|
|
180
|
+
return s.length === 1 ? s[0] : null;
|
|
186
181
|
}, Et = () => {
|
|
187
|
-
if (!
|
|
188
|
-
const n = C.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight,
|
|
189
|
-
|
|
182
|
+
if (!z || !C.current || !e.body) return null;
|
|
183
|
+
const n = C.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, s = qe.current, b = s ? rt(
|
|
184
|
+
s,
|
|
190
185
|
n
|
|
191
186
|
) : null;
|
|
192
|
-
if (
|
|
193
|
-
return Math.ceil(
|
|
194
|
-
const
|
|
187
|
+
if (b !== null)
|
|
188
|
+
return Math.ceil(b);
|
|
189
|
+
const E = e.body.querySelector(
|
|
195
190
|
".sandbox-wrapper"
|
|
196
191
|
)?.firstElementChild;
|
|
197
|
-
if (!
|
|
198
|
-
const
|
|
199
|
-
|
|
192
|
+
if (!E) return null;
|
|
193
|
+
const g = Array.from(E.children), w = g.length === 1 ? g[0] : null, L = Nt(
|
|
194
|
+
w,
|
|
200
195
|
{
|
|
201
|
-
getNode:
|
|
196
|
+
getNode: Le,
|
|
202
197
|
getSingleChild: je
|
|
203
198
|
}
|
|
204
199
|
).viewportHeightCss;
|
|
205
|
-
if (
|
|
206
|
-
const
|
|
207
|
-
|
|
200
|
+
if (L) {
|
|
201
|
+
const h = rt(
|
|
202
|
+
L,
|
|
208
203
|
n
|
|
209
204
|
);
|
|
210
|
-
if (
|
|
211
|
-
return Math.ceil(
|
|
205
|
+
if (h !== null)
|
|
206
|
+
return Math.ceil(h);
|
|
212
207
|
}
|
|
213
|
-
const
|
|
214
|
-
|
|
208
|
+
const ne = Vt(
|
|
209
|
+
w,
|
|
215
210
|
n,
|
|
216
211
|
{
|
|
217
|
-
getNode:
|
|
212
|
+
getNode: Le,
|
|
218
213
|
getSingleChild: je
|
|
219
214
|
}
|
|
220
215
|
);
|
|
221
|
-
return
|
|
222
|
-
},
|
|
216
|
+
return ne !== null ? Math.ceil(ne) : null;
|
|
217
|
+
}, xe = () => {
|
|
223
218
|
if (!C.current || !e.body) return;
|
|
224
|
-
if (!
|
|
225
|
-
if (
|
|
226
|
-
|
|
219
|
+
if (!v) {
|
|
220
|
+
if (ae.current) {
|
|
221
|
+
ue.current = !0;
|
|
227
222
|
return;
|
|
228
223
|
}
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
let
|
|
224
|
+
ae.current = !0;
|
|
225
|
+
const E = e.body.querySelector(".sandbox-container");
|
|
226
|
+
E && Dt(E);
|
|
227
|
+
const g = C.current, w = F.current?.clientWidth || 0, Ke = g.style.height;
|
|
228
|
+
if (w > 0) {
|
|
229
|
+
const L = Math.round(w * 9 / 16), ne = Math.max(8192, w * 20);
|
|
230
|
+
g.style.height = L + "px", e.body.offsetHeight;
|
|
231
|
+
let h = e.body.scrollHeight;
|
|
237
232
|
const Je = e.defaultView;
|
|
238
233
|
if (Je) {
|
|
239
|
-
const
|
|
240
|
-
let
|
|
234
|
+
const j = (T) => {
|
|
235
|
+
let p = 0;
|
|
241
236
|
const Qe = (k) => {
|
|
242
237
|
const Ze = Je.getComputedStyle(k);
|
|
243
|
-
if (Ze.position === "fixed" && (
|
|
244
|
-
|
|
238
|
+
if (Ze.position === "fixed" && (p = Math.max(
|
|
239
|
+
p,
|
|
245
240
|
Math.ceil(k.getBoundingClientRect().bottom)
|
|
246
|
-
)), k !==
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
241
|
+
)), k !== T && k.scrollHeight > k.clientHeight + 1) {
|
|
242
|
+
const re = Ze.overflowY;
|
|
243
|
+
if (re === "auto" || re === "scroll") {
|
|
249
244
|
const et = k.getBoundingClientRect();
|
|
250
|
-
et.top >= 0 && (
|
|
251
|
-
|
|
245
|
+
et.top >= 0 && (p = Math.max(
|
|
246
|
+
p,
|
|
252
247
|
Math.ceil(et.top + k.scrollHeight)
|
|
253
248
|
));
|
|
254
249
|
}
|
|
255
250
|
}
|
|
256
|
-
for (const
|
|
251
|
+
for (const re of k.children) Qe(re);
|
|
257
252
|
};
|
|
258
|
-
return Qe(
|
|
253
|
+
return Qe(T), p;
|
|
259
254
|
};
|
|
260
|
-
|
|
261
|
-
for (let
|
|
262
|
-
|
|
263
|
-
const
|
|
255
|
+
h = Math.max(h, j(e.body));
|
|
256
|
+
for (let T = 0; T < 8 && h > L; T++) {
|
|
257
|
+
g.style.height = h + "px", e.body.offsetHeight;
|
|
258
|
+
const p = Math.max(
|
|
264
259
|
e.body.scrollHeight,
|
|
265
|
-
|
|
260
|
+
j(e.body)
|
|
266
261
|
);
|
|
267
|
-
if (
|
|
268
|
-
|
|
262
|
+
if (p <= h + 1 || p >= h * 1.5) break;
|
|
263
|
+
h = p;
|
|
269
264
|
}
|
|
270
265
|
}
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
return
|
|
266
|
+
g.style.height = Ke, Ht((j) => {
|
|
267
|
+
const T = Math.min(ne, Math.max(1, Math.ceil(h)));
|
|
268
|
+
return j === T ? j : T;
|
|
274
269
|
});
|
|
275
270
|
}
|
|
276
271
|
setTimeout(() => {
|
|
277
|
-
|
|
272
|
+
ae.current = !1, ue.current && (ue.current = !1, D());
|
|
278
273
|
}, 50);
|
|
279
274
|
return;
|
|
280
275
|
}
|
|
281
|
-
if (
|
|
282
|
-
const n = e.body.scrollHeight,
|
|
283
|
-
if (
|
|
284
|
-
const
|
|
276
|
+
if (S) return;
|
|
277
|
+
const n = e.body.scrollHeight, s = e.documentElement?.scrollHeight || 0, b = _?.scrollHeight || 0, I = Math.max(n, s, b);
|
|
278
|
+
if (z) {
|
|
279
|
+
const E = Et(), g = Math.max(
|
|
285
280
|
200,
|
|
286
|
-
|
|
281
|
+
E ?? Math.ceil(I)
|
|
287
282
|
);
|
|
288
|
-
|
|
289
|
-
(
|
|
283
|
+
pt(
|
|
284
|
+
(w) => w === g ? w : g
|
|
290
285
|
);
|
|
291
286
|
}
|
|
292
|
-
},
|
|
287
|
+
}, D = () => {
|
|
293
288
|
requestAnimationFrame(() => {
|
|
294
|
-
|
|
289
|
+
m || xe();
|
|
295
290
|
});
|
|
296
291
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
292
|
+
W.current = D, xe(), D(), he && it().then(({ injectBlackboardLibraries: n }) => {
|
|
293
|
+
m || (n(e), S && zt(e), requestAnimationFrame(() => {
|
|
294
|
+
m || D();
|
|
300
295
|
}));
|
|
301
296
|
}).catch(() => {
|
|
302
|
-
|
|
297
|
+
m || D();
|
|
303
298
|
});
|
|
304
|
-
const
|
|
305
|
-
let
|
|
299
|
+
const d = F.current;
|
|
300
|
+
let Re = !!(d && (d.clientWidth <= 0 || d.clientHeight <= 0)), Z = !1, ee = null, te = null;
|
|
306
301
|
const Ge = () => {
|
|
307
|
-
if (
|
|
308
|
-
|
|
309
|
-
}, Ce = () => !!(
|
|
310
|
-
!
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
302
|
+
if (m) return;
|
|
303
|
+
D(), t.contentWindow?.__mdf_triggerFitContent?.();
|
|
304
|
+
}, Ce = () => !!(d && d.clientWidth > 0 && d.clientHeight > 0), Ye = () => {
|
|
305
|
+
!he || !d || !Re || Z || !Ce() || (Z = !0, it().then(({ refreshTailwindRuntime: n }) => {
|
|
306
|
+
m || (ee = window.requestAnimationFrame(() => {
|
|
307
|
+
ee = null, Z = !1;
|
|
308
|
+
const s = e.querySelector(".sandbox-container");
|
|
309
|
+
m || !Ce() || !s?.childNodes.length || !n(e) || (Re = !1, Ge(), te = window.setTimeout(() => {
|
|
310
|
+
te = null, Ge();
|
|
316
311
|
}, 100));
|
|
317
312
|
}));
|
|
318
313
|
}).catch(() => {
|
|
319
|
-
|
|
314
|
+
Z = !1;
|
|
320
315
|
}));
|
|
321
|
-
}, Ue = typeof ResizeObserver < "u",
|
|
322
|
-
const
|
|
323
|
-
|
|
316
|
+
}, Ue = typeof ResizeObserver < "u", ve = he && d && Ue ? new ResizeObserver((n) => {
|
|
317
|
+
const s = n[0]?.contentRect, b = s?.width ?? d.clientWidth, I = s?.height ?? d.clientHeight;
|
|
318
|
+
b > 0 && I > 0 && Ye();
|
|
324
319
|
}) : null;
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
if (r !== "sandbox" ||
|
|
320
|
+
ve && d && ve.observe(d);
|
|
321
|
+
const Se = Ue ? new ResizeObserver(() => xe()) : null;
|
|
322
|
+
Se?.observe(e.body), _ && Se?.observe(_);
|
|
323
|
+
const Tt = () => {
|
|
324
|
+
if (r !== "sandbox" || Oe.current !== "auto")
|
|
330
325
|
return;
|
|
331
|
-
const n = e.querySelector(".sandbox-wrapper"),
|
|
332
|
-
if (!n || !
|
|
333
|
-
const
|
|
334
|
-
|
|
335
|
-
(
|
|
326
|
+
const n = e.querySelector(".sandbox-wrapper"), s = e.defaultView;
|
|
327
|
+
if (!n || !s) return;
|
|
328
|
+
const b = s.getComputedStyle(n).direction === "rtl" ? "rtl" : "ltr";
|
|
329
|
+
bt(
|
|
330
|
+
(I) => I === b ? I : b
|
|
336
331
|
);
|
|
337
332
|
}, Xe = new MutationObserver(() => {
|
|
338
|
-
if (
|
|
339
|
-
|
|
333
|
+
if (Tt(), D(), !Ce()) {
|
|
334
|
+
Re = !0;
|
|
340
335
|
return;
|
|
341
336
|
}
|
|
342
337
|
Ye();
|
|
@@ -348,47 +343,47 @@ const it = () => (Me || (Me = import("./blackboard-vendor.es.js")), Me), ct = /<
|
|
|
348
343
|
attributes: !0,
|
|
349
344
|
attributeFilter: ["style", "class", "dir"]
|
|
350
345
|
}), () => {
|
|
351
|
-
|
|
346
|
+
m = !0, ve?.disconnect(), Se?.disconnect(), Xe.disconnect(), ee !== null && window.cancelAnimationFrame(ee), te !== null && window.clearTimeout(te), S && t.contentWindow?.__mdf_cleanupScaling?.(), u && e.removeEventListener("click", M, !0), X.current === N && (X.current = null, W.current = () => {
|
|
352
347
|
}), setTimeout(() => {
|
|
353
|
-
|
|
348
|
+
N.unmount();
|
|
354
349
|
}, 0);
|
|
355
350
|
};
|
|
356
|
-
}, []),
|
|
351
|
+
}, []), H(() => {
|
|
357
352
|
const t = () => {
|
|
358
|
-
|
|
353
|
+
Ct(!!document.fullscreenElement);
|
|
359
354
|
};
|
|
360
355
|
return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
|
|
361
|
-
}, []),
|
|
362
|
-
const t =
|
|
356
|
+
}, []), H(() => {
|
|
357
|
+
const t = F.current;
|
|
363
358
|
if (!t) return;
|
|
364
|
-
const e =
|
|
365
|
-
|
|
359
|
+
const e = Ae.current, u = () => {
|
|
360
|
+
xt(
|
|
366
361
|
e ? Math.ceil(e.offsetTop + e.offsetHeight) : 0
|
|
367
362
|
);
|
|
368
363
|
};
|
|
369
364
|
if (typeof ResizeObserver > "u") {
|
|
370
|
-
|
|
365
|
+
le(t.clientWidth), u();
|
|
371
366
|
return;
|
|
372
367
|
}
|
|
373
|
-
const
|
|
374
|
-
const
|
|
375
|
-
|
|
368
|
+
const M = new ResizeObserver((_) => {
|
|
369
|
+
const N = _.find((m) => m.target === t);
|
|
370
|
+
N && le(N.contentRect.width), u();
|
|
376
371
|
});
|
|
377
|
-
return
|
|
378
|
-
}, [
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
372
|
+
return M.observe(t), e && M.observe(e), le(t.clientWidth), u(), () => M.disconnect();
|
|
373
|
+
}, [Te]);
|
|
374
|
+
const He = At(() => {
|
|
375
|
+
if (v || K === 0 || de)
|
|
381
376
|
return;
|
|
382
|
-
const t = Math.round(
|
|
383
|
-
return { height: Math.max(
|
|
377
|
+
const t = Math.round(K * 9 / 16);
|
|
378
|
+
return { height: Math.max(se ?? t, Ne) };
|
|
384
379
|
}, [
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
]),
|
|
391
|
-
const t =
|
|
380
|
+
v,
|
|
381
|
+
K,
|
|
382
|
+
se,
|
|
383
|
+
de,
|
|
384
|
+
Ne
|
|
385
|
+
]), St = He ? Math.max(Math.round(K * 9 / 16), se ?? 0) : void 0, yt = () => {
|
|
386
|
+
const t = F.current || C.current;
|
|
392
387
|
if (t) {
|
|
393
388
|
if (document.fullscreenElement) {
|
|
394
389
|
document.exitFullscreen().catch(() => {
|
|
@@ -399,96 +394,100 @@ const it = () => (Me || (Me = import("./blackboard-vendor.es.js")), Me), ct = /<
|
|
|
399
394
|
});
|
|
400
395
|
}
|
|
401
396
|
};
|
|
402
|
-
|
|
403
|
-
const t =
|
|
397
|
+
H(() => {
|
|
398
|
+
const t = X.current;
|
|
404
399
|
if (!t) return;
|
|
405
400
|
t.render(
|
|
406
|
-
/* @__PURE__ */
|
|
407
|
-
|
|
401
|
+
/* @__PURE__ */ V(
|
|
402
|
+
_t,
|
|
408
403
|
{
|
|
409
404
|
html: $,
|
|
410
|
-
|
|
405
|
+
hasPendingHtml: $e,
|
|
406
|
+
locale: f,
|
|
411
407
|
dir: Ie,
|
|
412
|
-
lang:
|
|
413
|
-
loadingText:
|
|
414
|
-
|
|
408
|
+
lang: Fe,
|
|
409
|
+
loadingText: B,
|
|
410
|
+
styleLoadingText: Me,
|
|
411
|
+
scriptLoadingText: Ee,
|
|
412
|
+
disableLoadingOverlay: oe,
|
|
415
413
|
resetToken: Be,
|
|
416
|
-
hasRootVhHeight:
|
|
414
|
+
hasRootVhHeight: pe,
|
|
417
415
|
mode: a,
|
|
418
|
-
stretchRootHeight:
|
|
419
|
-
enableScaling:
|
|
420
|
-
deferScripts: be
|
|
416
|
+
stretchRootHeight: me,
|
|
417
|
+
enableScaling: S
|
|
421
418
|
}
|
|
422
419
|
)
|
|
423
|
-
),
|
|
424
|
-
|
|
420
|
+
), y.current = window.requestAnimationFrame(() => {
|
|
421
|
+
W.current?.(), S && C.current?.contentWindow?.__mdf_triggerFitContent?.(), y.current = null;
|
|
425
422
|
});
|
|
426
|
-
const e = setTimeout(() =>
|
|
423
|
+
const e = setTimeout(() => W.current?.(), 100), u = setTimeout(() => W.current?.(), 500);
|
|
427
424
|
return () => {
|
|
428
|
-
|
|
425
|
+
y.current !== null && (window.cancelAnimationFrame(y.current), y.current = null), clearTimeout(e), clearTimeout(u);
|
|
429
426
|
};
|
|
430
427
|
}, [
|
|
431
428
|
$,
|
|
432
|
-
|
|
429
|
+
$e,
|
|
430
|
+
f,
|
|
433
431
|
Ie,
|
|
434
|
-
|
|
435
|
-
|
|
432
|
+
Fe,
|
|
433
|
+
B,
|
|
434
|
+
Me,
|
|
435
|
+
Ee,
|
|
436
436
|
Be,
|
|
437
|
-
|
|
438
|
-
|
|
437
|
+
oe,
|
|
438
|
+
pe,
|
|
439
439
|
a,
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
be
|
|
440
|
+
me,
|
|
441
|
+
S
|
|
443
442
|
]);
|
|
444
443
|
const Mt = [
|
|
445
444
|
`w-full relative content-render-iframe-sandbox content-render-iframe-sandbox--${r}`,
|
|
446
|
-
|
|
445
|
+
v ? "h-full overflow-auto flex flex-col" : He ? "overflow-hidden" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
|
|
447
446
|
].filter(Boolean).join(" ");
|
|
448
|
-
return /* @__PURE__ */
|
|
447
|
+
return /* @__PURE__ */ kt(
|
|
449
448
|
"div",
|
|
450
449
|
{
|
|
451
|
-
ref:
|
|
452
|
-
dir:
|
|
453
|
-
lang:
|
|
454
|
-
"data-root-vh":
|
|
450
|
+
ref: F,
|
|
451
|
+
dir: R,
|
|
452
|
+
lang: ie,
|
|
453
|
+
"data-root-vh": pe ? "true" : "false",
|
|
455
454
|
className: Mt,
|
|
456
|
-
style:
|
|
457
|
-
height:
|
|
458
|
-
minHeight:
|
|
459
|
-
} :
|
|
455
|
+
style: q ? {
|
|
456
|
+
height: q,
|
|
457
|
+
minHeight: q
|
|
458
|
+
} : He,
|
|
460
459
|
children: [
|
|
461
|
-
!
|
|
460
|
+
!Te && /* @__PURE__ */ V(
|
|
462
461
|
"button",
|
|
463
462
|
{
|
|
464
|
-
ref:
|
|
463
|
+
ref: Ae,
|
|
465
464
|
type: "button",
|
|
466
|
-
dir:
|
|
467
|
-
onClick:
|
|
465
|
+
dir: U,
|
|
466
|
+
onClick: yt,
|
|
468
467
|
className: "absolute top-2 end-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
|
|
469
|
-
children:
|
|
468
|
+
children: de ? ht : dt
|
|
470
469
|
}
|
|
471
470
|
),
|
|
472
|
-
a === "blackboard" && r === "markdown" ? /* @__PURE__ */
|
|
473
|
-
|
|
471
|
+
a === "blackboard" && r === "markdown" ? /* @__PURE__ */ V("div", { ref: ft, children: /* @__PURE__ */ V(
|
|
472
|
+
It,
|
|
474
473
|
{
|
|
475
|
-
content:
|
|
476
|
-
locale:
|
|
477
|
-
dir:
|
|
478
|
-
lang:
|
|
479
|
-
disableSandboxLoadingOverlay:
|
|
474
|
+
content: c,
|
|
475
|
+
locale: f,
|
|
476
|
+
dir: R,
|
|
477
|
+
lang: ie,
|
|
478
|
+
disableSandboxLoadingOverlay: oe
|
|
480
479
|
}
|
|
481
|
-
) }) : /* @__PURE__ */
|
|
480
|
+
) }) : /* @__PURE__ */ V(
|
|
482
481
|
"iframe",
|
|
483
482
|
{
|
|
484
483
|
ref: C,
|
|
485
484
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
486
485
|
allow: "fullscreen",
|
|
487
486
|
allowFullScreen: !0,
|
|
488
|
-
className: [
|
|
487
|
+
className: [l, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
489
488
|
style: {
|
|
490
|
-
height:
|
|
491
|
-
minHeight:
|
|
489
|
+
height: q ?? St ?? "100%",
|
|
490
|
+
minHeight: q,
|
|
492
491
|
margin: "auto"
|
|
493
492
|
}
|
|
494
493
|
}
|
|
@@ -496,11 +495,11 @@ const it = () => (Me || (Me = import("./blackboard-vendor.es.js")), Me), ct = /<
|
|
|
496
495
|
]
|
|
497
496
|
}
|
|
498
497
|
);
|
|
499
|
-
},
|
|
500
|
-
const r =
|
|
501
|
-
return /* @__PURE__ */
|
|
498
|
+
}, hn = (c) => {
|
|
499
|
+
const r = c.mode ?? "content", l = !!(c.enableScaling && r === "blackboard" && c.type === "sandbox"), f = `${c.type}:${r}:${l ? "scaled" : "unscaled"}`;
|
|
500
|
+
return /* @__PURE__ */ V(Kt, { ...c }, f);
|
|
502
501
|
};
|
|
503
502
|
export {
|
|
504
|
-
|
|
503
|
+
hn as default
|
|
505
504
|
};
|
|
506
505
|
//# sourceMappingURL=IframeSandbox.es.js.map
|