markdown-flow-ui 0.1.100-beta.13 → 0.1.100-beta.15
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/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/Documents/ai-shifu/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/Documents/ai-shifu/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/Documents/ai-shifu/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/Documents/ai-shifu/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/Documents/ai-shifu/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/Documents/ai-shifu/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/Documents/ai-shifu/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/Documents/ai-shifu/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/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
- package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
- package/dist/_virtual/index.cjs4.js +1 -1
- package/dist/_virtual/index.cjs5.js +1 -1
- package/dist/_virtual/index.cjs6.js +1 -1
- package/dist/_virtual/index.es4.js +4 -4
- package/dist/_virtual/index.es5.js +4 -4
- package/dist/_virtual/index.es6.js +5 -5
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs.js +4 -4
- package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.d.ts +1 -0
- package/dist/components/ContentRender/IframeSandbox.es.js +237 -199
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
- package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
- package/dist/components/ContentRender/SandboxApp.d.ts +1 -0
- package/dist/components/ContentRender/SandboxApp.es.js +70 -66
- package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
- package/dist/components/Slide/Player.cjs.js +1 -1
- package/dist/components/Slide/Player.cjs.js.map +1 -1
- package/dist/components/Slide/Player.d.ts +1 -0
- package/dist/components/Slide/Player.es.js +157 -151
- package/dist/components/Slide/Player.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.js +1 -1
- package/dist/components/Slide/Slide.cjs.js.map +1 -1
- package/dist/components/Slide/Slide.d.ts +1 -0
- package/dist/components/Slide/Slide.es.js +325 -266
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/Slide.stories.d.ts +2 -0
- package/dist/components/Slide/useSlide.cjs.js +1 -1
- package/dist/components/Slide/useSlide.cjs.js.map +1 -1
- package/dist/components/Slide/useSlide.d.ts +1 -0
- package/dist/components/Slide/useSlide.es.js +109 -87
- package/dist/components/Slide/useSlide.es.js.map +1 -1
- 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-lib.css +1 -1
- package/package.json +1 -1
|
@@ -1,120 +1,157 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import
|
|
1
|
+
import { j as d } from "../../_virtual/jsx-runtime.es.js";
|
|
2
|
+
import D, { useRef as h, useState as k, useCallback as Re, useEffect as S } from "react";
|
|
3
|
+
import { createRoot as Ee } from "react-dom/client";
|
|
4
|
+
import He from "./SandboxApp.es.js";
|
|
5
5
|
import { splitContentSegments as ye } from "./utils/split-content.es.js";
|
|
6
|
-
import
|
|
7
|
-
import { SANDBOX_INTERACTION_MESSAGE_TYPE as
|
|
8
|
-
import
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
(
|
|
12
|
-
)),
|
|
13
|
-
typeof window < "u" &&
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
if (!
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
6
|
+
import Se from "./ContentRender.es.js";
|
|
7
|
+
import { SANDBOX_INTERACTION_MESSAGE_TYPE as Te, SANDBOX_INTERACTION_MESSAGE_SOURCE as Me } from "../../lib/sandboxInteraction.es.js";
|
|
8
|
+
import Ae from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
|
|
9
|
+
let Y = null;
|
|
10
|
+
const he = () => (Y || (Y = import("./blackboard-vendor.es.js").then(
|
|
11
|
+
(r) => r.injectBlackboardLibraries
|
|
12
|
+
)), Y);
|
|
13
|
+
typeof window < "u" && he();
|
|
14
|
+
const Ne = /<img\b[^>]*>/i, ke = 180, je = 240, W = (r) => r.split(/\s+/).filter(Boolean).map((t) => t.split(":").pop() || t), ue = (r) => {
|
|
15
|
+
const t = r.trim().toLowerCase();
|
|
16
|
+
if (!t) return null;
|
|
17
|
+
const o = t.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
|
|
18
|
+
return o ? `${o[1]}${o[2].toLowerCase()}` : null;
|
|
19
|
+
}, de = (r) => {
|
|
20
|
+
if (!r.trim()) return null;
|
|
21
|
+
const t = W(r);
|
|
22
|
+
if (t.includes("h-screen") || t.includes("h-dvh"))
|
|
23
23
|
return "100dvh";
|
|
24
|
-
if (
|
|
24
|
+
if (t.includes("h-svh"))
|
|
25
25
|
return "100svh";
|
|
26
|
-
if (
|
|
26
|
+
if (t.includes("h-lvh"))
|
|
27
27
|
return "100lvh";
|
|
28
|
-
const
|
|
29
|
-
(
|
|
28
|
+
const o = t.find(
|
|
29
|
+
(w) => /^h-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(w)
|
|
30
30
|
);
|
|
31
|
-
if (!
|
|
32
|
-
const
|
|
33
|
-
return
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
if (!o) return null;
|
|
32
|
+
const m = o.match(/^h-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i);
|
|
33
|
+
return m ? `${m[1]}${m[2].toLowerCase()}` : null;
|
|
34
|
+
}, Ie = (r) => {
|
|
35
|
+
const t = r.trim();
|
|
36
|
+
if (!t) return null;
|
|
37
|
+
const o = t.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
|
|
38
|
+
return o ? o[2]?.match(/\bclass\s*=\s*["']([^"']*)["']/i)?.[1] ?? null : null;
|
|
39
|
+
}, _e = (r) => {
|
|
40
|
+
const t = Ie(r);
|
|
41
|
+
return t ? W(t).includes("h-screen") : !1;
|
|
42
|
+
}, $e = (r) => r.split(/\s+/).filter(Boolean).map((t) => {
|
|
43
|
+
const o = t.split(":");
|
|
44
|
+
return o[o.length - 1] !== "h-screen" ? t : (o[o.length - 1] = "h-full", o.join(":"));
|
|
45
|
+
}).join(" "), ze = (r, t) => !t || !r.trim() ? r : r.replace(
|
|
46
|
+
/^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
|
|
47
|
+
(o, m, w = "") => {
|
|
48
|
+
const f = w.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
|
|
49
|
+
if (!f)
|
|
50
|
+
return o;
|
|
51
|
+
const E = $e(f[2]);
|
|
52
|
+
return E === f[2] ? o : `${m}${w.replace(
|
|
53
|
+
f[0],
|
|
54
|
+
`class=${f[1]}${E}${f[1]}`
|
|
55
|
+
)}>`;
|
|
56
|
+
}
|
|
57
|
+
), Ge = ({
|
|
58
|
+
content: r,
|
|
59
|
+
type: t,
|
|
60
|
+
className: o,
|
|
61
|
+
loadingText: m,
|
|
62
|
+
styleLoadingText: w,
|
|
63
|
+
scriptLoadingText: f,
|
|
64
|
+
fullScreenButtonText: E,
|
|
65
|
+
hideFullScreen: J = !1,
|
|
66
|
+
mode: b = "content",
|
|
67
|
+
replaceRootScreenHeightWithFull: j = !1
|
|
44
68
|
}) => {
|
|
45
|
-
const
|
|
46
|
-
}), [
|
|
47
|
-
|
|
48
|
-
),
|
|
49
|
-
const e = ye(
|
|
50
|
-
return (
|
|
69
|
+
const K = h(null), H = h(null), B = h(null), Q = h(null), L = h(() => {
|
|
70
|
+
}), [me, fe] = k(480), ee = h(0), [te, be] = k(0), [pe, ge] = k(!1), [O, F] = k(
|
|
71
|
+
t !== "sandbox"
|
|
72
|
+
), V = b === "blackboard", P = h(""), I = D.useMemo(() => {
|
|
73
|
+
const e = ye(r).filter((c) => c.type === "sandbox");
|
|
74
|
+
return (b === "blackboard" ? e[e.length - 1]?.value || "" : e.map((c) => c.value).join(`
|
|
51
75
|
`)) || "";
|
|
52
|
-
}, [
|
|
76
|
+
}, [r, b]), s = D.useMemo(
|
|
77
|
+
() => ze(
|
|
78
|
+
I,
|
|
79
|
+
j
|
|
80
|
+
),
|
|
81
|
+
[I, j]
|
|
82
|
+
), ne = D.useMemo(
|
|
83
|
+
() => j && _e(I),
|
|
84
|
+
[I, j]
|
|
85
|
+
), [_, re] = k(
|
|
86
|
+
s
|
|
87
|
+
), oe = h(s), q = h(s), T = h(null), y = Re((n) => {
|
|
53
88
|
if (typeof window > "u")
|
|
54
89
|
return;
|
|
55
90
|
const e = Date.now();
|
|
56
|
-
e -
|
|
91
|
+
e - ee.current < je || (ee.current = e, window.postMessage(
|
|
57
92
|
{
|
|
58
|
-
source:
|
|
59
|
-
type:
|
|
60
|
-
eventType:
|
|
93
|
+
source: Me,
|
|
94
|
+
type: Te,
|
|
95
|
+
eventType: n
|
|
61
96
|
},
|
|
62
97
|
window.location.origin
|
|
63
98
|
));
|
|
64
|
-
}, []),
|
|
65
|
-
|
|
99
|
+
}, []), G = () => {
|
|
100
|
+
T.current !== null && (window.clearTimeout(T.current), T.current = null);
|
|
66
101
|
};
|
|
67
|
-
|
|
102
|
+
S(
|
|
68
103
|
() => () => {
|
|
69
|
-
|
|
104
|
+
G();
|
|
70
105
|
},
|
|
71
106
|
[]
|
|
72
|
-
),
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const e = !!
|
|
76
|
-
|
|
77
|
-
|
|
107
|
+
), S(() => {
|
|
108
|
+
const n = oe.current;
|
|
109
|
+
oe.current = s;
|
|
110
|
+
const e = !!n && s.length > n.length && s.startsWith(n), l = Ne.test(
|
|
111
|
+
s
|
|
112
|
+
);
|
|
113
|
+
if (!(e && l)) {
|
|
114
|
+
G(), q.current = s, re(s);
|
|
78
115
|
return;
|
|
79
116
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
}, [
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
87
|
-
const e =
|
|
117
|
+
q.current = s, G(), T.current = window.setTimeout(() => {
|
|
118
|
+
re(q.current), T.current = null;
|
|
119
|
+
}, ke);
|
|
120
|
+
}, [s]);
|
|
121
|
+
const se = D.useMemo(() => {
|
|
122
|
+
const n = _.trim();
|
|
123
|
+
if (!n) return null;
|
|
124
|
+
const e = n.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
|
|
88
125
|
if (!e) return null;
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
126
|
+
const l = e[2] || "", c = l.match(/\bheight\s*=\s*["']([^"']+)["']/i);
|
|
127
|
+
if (c) {
|
|
128
|
+
const p = ue(c[1]);
|
|
129
|
+
if (p) return p;
|
|
93
130
|
}
|
|
94
|
-
const
|
|
131
|
+
const A = l.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
|
|
95
132
|
/\bheight\s*:\s*([^;]+)/i
|
|
96
133
|
)?.[1];
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
134
|
+
if (A) {
|
|
135
|
+
const p = ue(A);
|
|
136
|
+
if (p) return p;
|
|
100
137
|
}
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
}, [
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
138
|
+
const v = l.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1];
|
|
139
|
+
return v ? de(v) : null;
|
|
140
|
+
}, [_]), ie = !!se, le = t === "sandbox", M = V && t === "sandbox" ? ne ? "100%" : se ?? `${me}px` : void 0;
|
|
141
|
+
S(() => {
|
|
142
|
+
if (b !== "blackboard") {
|
|
143
|
+
P.current = s;
|
|
107
144
|
return;
|
|
108
145
|
}
|
|
109
|
-
const
|
|
110
|
-
!(
|
|
111
|
-
}, [
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
114
|
-
const e =
|
|
146
|
+
const n = P.current;
|
|
147
|
+
!(n && s.startsWith(n)) && n && be((l) => l + 1), P.current = s;
|
|
148
|
+
}, [b, s]), S(() => {
|
|
149
|
+
const n = H.current;
|
|
150
|
+
if (!n) return;
|
|
151
|
+
const e = n.contentDocument;
|
|
115
152
|
if (!e) return;
|
|
116
153
|
e.open(), e.write(`<!DOCTYPE html>
|
|
117
|
-
<html${
|
|
154
|
+
<html${b === "blackboard" ? ' style="height: 100%;"' : ""}>
|
|
118
155
|
<head>
|
|
119
156
|
<meta charset="utf-8" />
|
|
120
157
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -127,173 +164,174 @@ const Te = /<img\b[^>]*>/i, Ae = 180, Me = 240, ae = (s) => s.split(/\s+/).filte
|
|
|
127
164
|
<body>
|
|
128
165
|
<div id="root"></div>
|
|
129
166
|
</body>
|
|
130
|
-
</html>`), e.close(),
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
let
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
if (!
|
|
141
|
-
const
|
|
142
|
-
return Number.isNaN(
|
|
143
|
-
},
|
|
144
|
-
if (!
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
return
|
|
148
|
-
const
|
|
149
|
-
(
|
|
167
|
+
</html>`), e.close(), Q.current = e;
|
|
168
|
+
const l = V && t === "sandbox", c = () => y("pointerdown"), U = () => y("mousedown"), A = () => y("touchstart");
|
|
169
|
+
l && (e.addEventListener("pointerdown", c, !0), e.addEventListener("mousedown", U, !0), e.addEventListener("touchstart", A, !0));
|
|
170
|
+
const v = e.getElementById("root");
|
|
171
|
+
if (!v) return;
|
|
172
|
+
const p = Ee(v);
|
|
173
|
+
B.current = p;
|
|
174
|
+
let N = !1;
|
|
175
|
+
const ae = (a, g) => {
|
|
176
|
+
const i = a.trim().toLowerCase();
|
|
177
|
+
if (!i) return null;
|
|
178
|
+
const u = Number.parseFloat(i);
|
|
179
|
+
return Number.isNaN(u) ? null : /(dvh|svh|lvh|vh)$/i.test(i) ? u / 100 * g : i.endsWith("px") || /^[0-9.]+$/.test(i) ? u : null;
|
|
180
|
+
}, xe = (a, g) => {
|
|
181
|
+
if (!a.trim()) return null;
|
|
182
|
+
const i = de(a);
|
|
183
|
+
if (i)
|
|
184
|
+
return ae(i, g);
|
|
185
|
+
const x = W(a).find(
|
|
186
|
+
(z) => /^h-\[[0-9.]+px\]$/i.test(z)
|
|
150
187
|
);
|
|
151
|
-
if (!
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
154
|
-
const
|
|
155
|
-
return Number.isNaN(
|
|
156
|
-
},
|
|
157
|
-
if (!
|
|
158
|
-
const
|
|
188
|
+
if (!x) return null;
|
|
189
|
+
const C = x.match(/^h-\[([0-9.]+)px\]$/i);
|
|
190
|
+
if (!C) return null;
|
|
191
|
+
const R = Number.parseFloat(C[1]);
|
|
192
|
+
return Number.isNaN(R) ? null : R;
|
|
193
|
+
}, Ce = () => {
|
|
194
|
+
if (!H.current || !e.body) return null;
|
|
195
|
+
const g = e.body.querySelector(
|
|
159
196
|
".sandbox-wrapper"
|
|
160
197
|
)?.firstElementChild;
|
|
161
|
-
if (!
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
166
|
-
return Math.ceil(
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
198
|
+
if (!g) return null;
|
|
199
|
+
const i = Array.from(g.children);
|
|
200
|
+
if (i.length !== 1) return null;
|
|
201
|
+
const u = i[0], x = u.style.height || u.getAttribute("height"), C = H.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, R = x ? ae(x, C) : null;
|
|
202
|
+
if (R !== null)
|
|
203
|
+
return Math.ceil(R);
|
|
204
|
+
const z = xe(
|
|
205
|
+
u.getAttribute("class") || "",
|
|
206
|
+
C
|
|
170
207
|
);
|
|
171
|
-
return
|
|
172
|
-
},
|
|
173
|
-
if (!
|
|
174
|
-
const
|
|
208
|
+
return z !== null ? Math.ceil(z) : null;
|
|
209
|
+
}, X = () => {
|
|
210
|
+
if (!H.current || !e.body) return;
|
|
211
|
+
const a = e.body.getBoundingClientRect(), g = e.documentElement?.getBoundingClientRect(), i = a.height, u = g?.height || 0, x = Math.max(i, u), C = Ce(), R = Math.max(
|
|
175
212
|
200,
|
|
176
|
-
|
|
213
|
+
C ?? Math.ceil(x)
|
|
177
214
|
);
|
|
178
|
-
|
|
179
|
-
},
|
|
215
|
+
fe(R);
|
|
216
|
+
}, $ = () => {
|
|
180
217
|
requestAnimationFrame(() => {
|
|
181
|
-
|
|
218
|
+
N || X();
|
|
182
219
|
});
|
|
183
220
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
221
|
+
L.current = $, X(), $(), le ? he().then((a) => {
|
|
222
|
+
N || (a(e), requestAnimationFrame(() => {
|
|
223
|
+
N || (F(!0), $());
|
|
187
224
|
}));
|
|
188
225
|
}).catch(() => {
|
|
189
|
-
|
|
190
|
-
}) :
|
|
191
|
-
const
|
|
192
|
-
return
|
|
193
|
-
|
|
194
|
-
|
|
226
|
+
N || (F(!0), $());
|
|
227
|
+
}) : F(!0);
|
|
228
|
+
const Z = new ResizeObserver(() => X());
|
|
229
|
+
return Z.observe(e.body), v && Z.observe(v), () => {
|
|
230
|
+
N = !0, Z.disconnect(), l && (e.removeEventListener("pointerdown", c, !0), e.removeEventListener("mousedown", U, !0), e.removeEventListener("touchstart", A, !0)), setTimeout(() => {
|
|
231
|
+
p.unmount(), B.current = null, Q.current = null, L.current = () => {
|
|
195
232
|
};
|
|
196
233
|
}, 0);
|
|
197
234
|
};
|
|
198
|
-
}, []),
|
|
199
|
-
const
|
|
200
|
-
|
|
235
|
+
}, []), S(() => {
|
|
236
|
+
const n = () => {
|
|
237
|
+
ge(!!document.fullscreenElement);
|
|
201
238
|
};
|
|
202
|
-
return document.addEventListener("fullscreenchange",
|
|
239
|
+
return document.addEventListener("fullscreenchange", n), () => document.removeEventListener("fullscreenchange", n);
|
|
203
240
|
}, []);
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
241
|
+
const we = () => {
|
|
242
|
+
const n = K.current || H.current;
|
|
243
|
+
if (n) {
|
|
207
244
|
if (document.fullscreenElement) {
|
|
208
245
|
document.exitFullscreen().catch(() => {
|
|
209
246
|
});
|
|
210
247
|
return;
|
|
211
248
|
}
|
|
212
|
-
|
|
249
|
+
n.requestFullscreen && n.requestFullscreen().catch(() => {
|
|
213
250
|
});
|
|
214
251
|
}
|
|
215
252
|
};
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
!
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
|
|
253
|
+
S(() => {
|
|
254
|
+
const n = B.current;
|
|
255
|
+
!n || !O || (n.render(
|
|
256
|
+
/* @__PURE__ */ d.jsx(
|
|
257
|
+
He,
|
|
221
258
|
{
|
|
222
|
-
html:
|
|
223
|
-
loadingText:
|
|
224
|
-
styleLoadingText:
|
|
225
|
-
scriptLoadingText:
|
|
226
|
-
fullScreenButtonText:
|
|
227
|
-
hideFullScreen:
|
|
228
|
-
resetToken:
|
|
229
|
-
hasRootVhHeight:
|
|
230
|
-
mode:
|
|
259
|
+
html: _,
|
|
260
|
+
loadingText: m,
|
|
261
|
+
styleLoadingText: w,
|
|
262
|
+
scriptLoadingText: f,
|
|
263
|
+
fullScreenButtonText: E,
|
|
264
|
+
hideFullScreen: J,
|
|
265
|
+
resetToken: te,
|
|
266
|
+
hasRootVhHeight: ie,
|
|
267
|
+
mode: b,
|
|
268
|
+
stretchRootHeight: ne
|
|
231
269
|
}
|
|
232
270
|
)
|
|
233
|
-
), requestAnimationFrame(() =>
|
|
271
|
+
), requestAnimationFrame(() => L.current?.()));
|
|
234
272
|
}, [
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
273
|
+
_,
|
|
274
|
+
m,
|
|
275
|
+
w,
|
|
276
|
+
f,
|
|
277
|
+
E,
|
|
278
|
+
te,
|
|
279
|
+
b,
|
|
280
|
+
O
|
|
243
281
|
]);
|
|
244
|
-
const
|
|
282
|
+
const ve = [
|
|
245
283
|
"w-full relative content-render-iframe-sandbox",
|
|
246
|
-
|
|
247
|
-
].filter(Boolean).join(" "),
|
|
248
|
-
return /* @__PURE__ */
|
|
284
|
+
V ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
|
|
285
|
+
].filter(Boolean).join(" "), ce = le && !O;
|
|
286
|
+
return /* @__PURE__ */ d.jsxs(
|
|
249
287
|
"div",
|
|
250
288
|
{
|
|
251
|
-
ref:
|
|
252
|
-
"data-root-vh":
|
|
253
|
-
className:
|
|
254
|
-
style:
|
|
255
|
-
height:
|
|
256
|
-
minHeight:
|
|
289
|
+
ref: K,
|
|
290
|
+
"data-root-vh": ie ? "true" : "false",
|
|
291
|
+
className: ve,
|
|
292
|
+
style: M ? {
|
|
293
|
+
height: M,
|
|
294
|
+
minHeight: M
|
|
257
295
|
} : void 0,
|
|
258
296
|
children: [
|
|
259
|
-
!
|
|
297
|
+
!J && /* @__PURE__ */ d.jsx(
|
|
260
298
|
"button",
|
|
261
299
|
{
|
|
262
300
|
type: "button",
|
|
263
|
-
onClick:
|
|
301
|
+
onClick: we,
|
|
264
302
|
className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
|
|
265
|
-
children:
|
|
303
|
+
children: pe ? "退出全屏" : E || "全屏浏览"
|
|
266
304
|
}
|
|
267
305
|
),
|
|
268
|
-
|
|
306
|
+
b === "blackboard" && t === "markdown" ? /* @__PURE__ */ d.jsx(
|
|
269
307
|
"div",
|
|
270
308
|
{
|
|
271
309
|
onMouseDown: () => y("mousedown"),
|
|
272
310
|
onPointerDown: () => y("pointerdown"),
|
|
273
311
|
onTouchStart: () => y("touchstart"),
|
|
274
|
-
children: /* @__PURE__ */
|
|
312
|
+
children: /* @__PURE__ */ d.jsx(Se, { content: r })
|
|
275
313
|
}
|
|
276
|
-
) : /* @__PURE__ */
|
|
277
|
-
/* @__PURE__ */
|
|
314
|
+
) : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
|
315
|
+
/* @__PURE__ */ d.jsx(
|
|
278
316
|
"iframe",
|
|
279
317
|
{
|
|
280
|
-
ref:
|
|
318
|
+
ref: H,
|
|
281
319
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
282
320
|
allow: "fullscreen",
|
|
283
321
|
allowFullScreen: !0,
|
|
284
|
-
className: [
|
|
322
|
+
className: [o, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
|
|
285
323
|
style: {
|
|
286
|
-
height:
|
|
287
|
-
minHeight:
|
|
324
|
+
height: M ?? "100%",
|
|
325
|
+
minHeight: M,
|
|
288
326
|
margin: "auto",
|
|
289
|
-
visibility:
|
|
327
|
+
visibility: ce ? "hidden" : "visible"
|
|
290
328
|
}
|
|
291
329
|
}
|
|
292
330
|
),
|
|
293
|
-
|
|
294
|
-
|
|
331
|
+
ce ? /* @__PURE__ */ d.jsx("div", { className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center", children: /* @__PURE__ */ d.jsx(
|
|
332
|
+
Ae,
|
|
295
333
|
{
|
|
296
|
-
"aria-label":
|
|
334
|
+
"aria-label": m || "Preparing sandbox styles",
|
|
297
335
|
className: "text-primary h-7 w-7 animate-spin"
|
|
298
336
|
}
|
|
299
337
|
) }) : null
|
|
@@ -303,6 +341,6 @@ const Te = /<img\b[^>]*>/i, Ae = 180, Me = 240, ae = (s) => s.split(/\s+/).filte
|
|
|
303
341
|
);
|
|
304
342
|
};
|
|
305
343
|
export {
|
|
306
|
-
|
|
344
|
+
Ge as default
|
|
307
345
|
};
|
|
308
346
|
//# sourceMappingURL=IframeSandbox.es.js.map
|