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