@particle-academy/react-fancy 5.67.0 → 5.69.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/CHANGELOG.md +63 -0
- package/dist/ContentRenderer.types-RO_l7_6N.d.cts +137 -0
- package/dist/ContentRenderer.types-RO_l7_6N.d.ts +137 -0
- package/dist/{PastedFilesInput-Bt3KSTVN.d.ts → PastedFilesInput-BT5y95sb.d.ts} +2 -1
- package/dist/{PastedFilesInput-CUQeOeOA.d.cts → PastedFilesInput-Cd4k6a38.d.cts} +2 -1
- package/dist/{chunk-U5LKNGHU.cjs → chunk-2PSHIUM7.cjs} +8 -8
- package/dist/{chunk-U5LKNGHU.cjs.map → chunk-2PSHIUM7.cjs.map} +1 -1
- package/dist/{chunk-QSGAFKK2.js → chunk-4UEIMGHZ.js} +3 -3
- package/dist/{chunk-QSGAFKK2.js.map → chunk-4UEIMGHZ.js.map} +1 -1
- package/dist/{chunk-YIKXJWO4.js → chunk-4WIPWJYD.js} +5 -4
- package/dist/chunk-4WIPWJYD.js.map +1 -0
- package/dist/{chunk-7FYRFNPX.cjs → chunk-FPFQBYKJ.cjs} +9 -9
- package/dist/{chunk-7FYRFNPX.cjs.map → chunk-FPFQBYKJ.cjs.map} +1 -1
- package/dist/{chunk-23AVEYUP.js → chunk-HRZDEZSE.js} +24 -19
- package/dist/chunk-HRZDEZSE.js.map +1 -0
- package/dist/{chunk-SAG6DHQK.cjs → chunk-ISNS4GAW.cjs} +29 -24
- package/dist/chunk-ISNS4GAW.cjs.map +1 -0
- package/dist/{chunk-6CAXLP7D.cjs → chunk-J5TFVYYM.cjs} +6 -6
- package/dist/{chunk-6CAXLP7D.cjs.map → chunk-J5TFVYYM.cjs.map} +1 -1
- package/dist/{chunk-E5UU666U.cjs → chunk-KGJ2ORY6.cjs} +148 -56
- package/dist/chunk-KGJ2ORY6.cjs.map +1 -0
- package/dist/{chunk-HEY4SMS2.js → chunk-LLVYCACC.js} +10 -4
- package/dist/chunk-LLVYCACC.js.map +1 -0
- package/dist/{chunk-4S5DFN5N.cjs → chunk-O4KZYGGC.cjs} +17 -11
- package/dist/chunk-O4KZYGGC.cjs.map +1 -0
- package/dist/{chunk-DCAD2JPP.js → chunk-U4PWNLOH.js} +3 -3
- package/dist/{chunk-DCAD2JPP.js.map → chunk-U4PWNLOH.js.map} +1 -1
- package/dist/{chunk-B4LVQ4QI.js → chunk-YEGFOMJB.js} +3 -3
- package/dist/{chunk-B4LVQ4QI.js.map → chunk-YEGFOMJB.js.map} +1 -1
- package/dist/{chunk-HFK5SBNM.cjs → chunk-YJETQ76J.cjs} +5 -4
- package/dist/chunk-YJETQ76J.cjs.map +1 -0
- package/dist/{chunk-FXOT4P4P.js → chunk-Z6RA37IC.js} +148 -56
- package/dist/chunk-Z6RA37IC.js.map +1 -0
- package/dist/composer.cjs +4 -4
- package/dist/composer.js +2 -2
- package/dist/content-renderer.cjs +4 -4
- package/dist/content-renderer.d.cts +3 -72
- package/dist/content-renderer.d.ts +3 -72
- package/dist/content-renderer.js +1 -1
- package/dist/editor.cjs +4 -4
- package/dist/editor.d.cts +19 -2
- package/dist/editor.d.ts +19 -2
- package/dist/editor.js +2 -2
- package/dist/{index-XR5t8bTq.d.ts → index-BQi_n6eS.d.ts} +21 -3
- package/dist/{index-DWtSViJ3.d.cts → index-n_4_OZK_.d.cts} +21 -3
- package/dist/index.cjs +38 -38
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/input.cjs +3 -3
- package/dist/input.js +2 -2
- package/dist/inputs.cjs +3 -3
- package/dist/inputs.js +2 -2
- package/dist/json-editor.cjs +14 -14
- package/dist/json-editor.js +3 -3
- package/dist/paste-pills.cjs +14 -14
- package/dist/paste-pills.d.cts +1 -1
- package/dist/paste-pills.d.ts +1 -1
- package/dist/paste-pills.js +1 -1
- package/dist/prompt-input.cjs +5 -5
- package/dist/prompt-input.d.cts +1 -1
- package/dist/prompt-input.d.ts +1 -1
- package/dist/prompt-input.js +2 -2
- package/docs/ContentRenderer.md +63 -6
- package/docs/Editor.md +38 -0
- package/docs/PromptInput.md +3 -2
- package/package.json +1 -1
- package/dist/chunk-23AVEYUP.js.map +0 -1
- package/dist/chunk-4S5DFN5N.cjs.map +0 -1
- package/dist/chunk-E5UU666U.cjs.map +0 -1
- package/dist/chunk-FXOT4P4P.js.map +0 -1
- package/dist/chunk-HEY4SMS2.js.map +0 -1
- package/dist/chunk-HFK5SBNM.cjs.map +0 -1
- package/dist/chunk-SAG6DHQK.cjs.map +0 -1
- package/dist/chunk-YIKXJWO4.js.map +0 -1
- package/dist/extensions-DiByZIpD.d.cts +0 -61
- package/dist/extensions-DiByZIpD.d.ts +0 -61
|
@@ -109,6 +109,19 @@ function markdownToRawHtml(markdown) {
|
|
|
109
109
|
function renderMarkdown(markdown, sanitize) {
|
|
110
110
|
return sanitizeHtml(markdownToRawHtml(markdown), sanitize);
|
|
111
111
|
}
|
|
112
|
+
|
|
113
|
+
// src/utils/visually-hidden.ts
|
|
114
|
+
var visuallyHidden = {
|
|
115
|
+
position: "absolute",
|
|
116
|
+
width: "1px",
|
|
117
|
+
height: "1px",
|
|
118
|
+
padding: 0,
|
|
119
|
+
margin: "-1px",
|
|
120
|
+
overflow: "hidden",
|
|
121
|
+
clip: "rect(0, 0, 0, 0)",
|
|
122
|
+
whiteSpace: "nowrap",
|
|
123
|
+
border: 0
|
|
124
|
+
};
|
|
112
125
|
var proseClasses = [
|
|
113
126
|
"[&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mt-4 [&_h1]:mb-2",
|
|
114
127
|
"[&_h2]:text-xl [&_h2]:font-semibold [&_h2]:mt-3 [&_h2]:mb-2",
|
|
@@ -876,7 +889,7 @@ function maskInlineCode(line) {
|
|
|
876
889
|
function scan(src, names, trackFences) {
|
|
877
890
|
const tokens = [];
|
|
878
891
|
let openFenceStart = -1;
|
|
879
|
-
if (names.length === 0 && !trackFences) return { tokens, openFenceStart };
|
|
892
|
+
if (names.length === 0 && !trackFences) return { tokens, openFenceStart, openFence: null };
|
|
880
893
|
const tagRe = names.length ? new RegExp(`<(\\/?)(${names.map(escapeRegExp).join("|")})(?=[\\s>/])([^>]*)>`, "gi") : null;
|
|
881
894
|
let fence = null;
|
|
882
895
|
let pos = 0;
|
|
@@ -927,7 +940,39 @@ function scan(src, names, trackFences) {
|
|
|
927
940
|
if (nl < 0) break;
|
|
928
941
|
pos = lineEnd + 1;
|
|
929
942
|
}
|
|
930
|
-
return { tokens, openFenceStart };
|
|
943
|
+
return { tokens, openFenceStart, openFence: fence };
|
|
944
|
+
}
|
|
945
|
+
function partialTagAt(lastLine, names, markdown) {
|
|
946
|
+
if (!names.length) return -1;
|
|
947
|
+
const masked = markdown ? maskInlineCode(lastLine) : lastLine;
|
|
948
|
+
const lt = masked.lastIndexOf("<");
|
|
949
|
+
if (lt < 0) return -1;
|
|
950
|
+
const m = /^<(\/?)([A-Za-z][\w-]*)?([^>]*)$/.exec(masked.slice(lt));
|
|
951
|
+
if (!m) return -1;
|
|
952
|
+
const name = (m[2] ?? "").toLowerCase();
|
|
953
|
+
const rest = m[3];
|
|
954
|
+
let partial = false;
|
|
955
|
+
if (!name) partial = rest === "";
|
|
956
|
+
else if (names.includes(name)) partial = rest === "" || /^\s/.test(rest);
|
|
957
|
+
else partial = rest === "" && names.some((n) => n.startsWith(name));
|
|
958
|
+
return partial ? lt : -1;
|
|
959
|
+
}
|
|
960
|
+
function openTagsBefore(tokens, cut) {
|
|
961
|
+
const stack = [];
|
|
962
|
+
for (const t of tokens) {
|
|
963
|
+
if (t.start >= cut) break;
|
|
964
|
+
if (t.kind === "open") {
|
|
965
|
+
stack.push(t);
|
|
966
|
+
continue;
|
|
967
|
+
}
|
|
968
|
+
for (let k = stack.length - 1; k >= 0; k--) {
|
|
969
|
+
if (stack[k].name === t.name) {
|
|
970
|
+
stack.length = k;
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
return stack;
|
|
931
976
|
}
|
|
932
977
|
function splitMarkdownBlocks(src, tags) {
|
|
933
978
|
const names = tags.map((t) => t.toLowerCase());
|
|
@@ -971,43 +1016,45 @@ function streamingCut(src, tags, markdown) {
|
|
|
971
1016
|
const { tokens, openFenceStart } = scan(src, names, markdown);
|
|
972
1017
|
let cut = src.length;
|
|
973
1018
|
if (openFenceStart >= 0) cut = Math.min(cut, openFenceStart);
|
|
974
|
-
const stack =
|
|
975
|
-
for (const t of tokens) {
|
|
976
|
-
if (t.start >= cut) break;
|
|
977
|
-
if (t.kind === "open") {
|
|
978
|
-
stack.push(t);
|
|
979
|
-
continue;
|
|
980
|
-
}
|
|
981
|
-
for (let k = stack.length - 1; k >= 0; k--) {
|
|
982
|
-
if (stack[k].name === t.name) {
|
|
983
|
-
stack.length = k;
|
|
984
|
-
break;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
}
|
|
1019
|
+
const stack = openTagsBefore(tokens, cut);
|
|
988
1020
|
if (stack.length) cut = Math.min(cut, stack[0].start);
|
|
989
1021
|
const lastLineStart = src.lastIndexOf("\n", cut - 1) + 1;
|
|
990
1022
|
const lastLine = src.slice(lastLineStart, cut);
|
|
991
1023
|
if (markdown && /^ {0,3}(`{1,2}|~{1,2})$/.test(lastLine)) {
|
|
992
1024
|
return Math.min(cut, lastLineStart);
|
|
993
1025
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1026
|
+
const lt = partialTagAt(lastLine, names, markdown);
|
|
1027
|
+
if (lt >= 0) cut = Math.min(cut, lastLineStart + lt);
|
|
1028
|
+
return cut;
|
|
1029
|
+
}
|
|
1030
|
+
function streamingProgressive(src, tags, markdown) {
|
|
1031
|
+
const names = tags.map((t) => t.toLowerCase());
|
|
1032
|
+
const { tokens, openFenceStart, openFence } = scan(src, names, markdown);
|
|
1033
|
+
let cut = src.length;
|
|
1034
|
+
let fence = openFenceStart >= 0 ? openFence : null;
|
|
1035
|
+
const lastLineStart = src.lastIndexOf("\n", cut - 1) + 1;
|
|
1036
|
+
const lastLine = src.slice(lastLineStart);
|
|
1037
|
+
if (fence) {
|
|
1038
|
+
if (openFenceStart === lastLineStart) {
|
|
1039
|
+
cut = openFenceStart;
|
|
1040
|
+
fence = null;
|
|
1041
|
+
} else {
|
|
1042
|
+
const m = /^ {0,3}(`+|~+)$/.exec(lastLine);
|
|
1043
|
+
if (m && m[1][0] === fence.char && m[1].length < fence.len) cut = lastLineStart;
|
|
1008
1044
|
}
|
|
1045
|
+
} else if (markdown && /^ {0,3}(`{1,2}|~{1,2})$/.test(lastLine)) {
|
|
1046
|
+
cut = lastLineStart;
|
|
1047
|
+
} else {
|
|
1048
|
+
const lt = partialTagAt(lastLine, names, markdown);
|
|
1049
|
+
if (lt >= 0) cut = lastLineStart + lt;
|
|
1009
1050
|
}
|
|
1010
|
-
|
|
1051
|
+
let out = src.slice(0, cut);
|
|
1052
|
+
if (fence) {
|
|
1053
|
+
out += (out.endsWith("\n") ? "" : "\n") + fence.char.repeat(fence.len) + "\n";
|
|
1054
|
+
}
|
|
1055
|
+
const stack = openTagsBefore(tokens, fence ? openFenceStart : cut);
|
|
1056
|
+
for (let k = stack.length - 1; k >= 0; k--) out += `</${stack[k].name}>`;
|
|
1057
|
+
return { source: out, openFence: fence !== null };
|
|
1011
1058
|
}
|
|
1012
1059
|
var FEEDBACK_MS = 2e3;
|
|
1013
1060
|
var WRITE_TIMEOUT_MS = 5e3;
|
|
@@ -1065,12 +1112,17 @@ function cellText(cell) {
|
|
|
1065
1112
|
for (const br of Array.from(clone.querySelectorAll("br"))) br.replaceWith(" ");
|
|
1066
1113
|
return (clone.textContent ?? "").replace(/[\t\r\n]+/g, " ").replace(/ {2,}/g, " ").trim();
|
|
1067
1114
|
}
|
|
1068
|
-
function HtmlChunk({
|
|
1115
|
+
function HtmlChunk({
|
|
1116
|
+
html,
|
|
1117
|
+
fromMarkdown,
|
|
1118
|
+
tail = false
|
|
1119
|
+
}) {
|
|
1069
1120
|
const ref = useRef(null);
|
|
1070
1121
|
const ctx = useContext(CopyContext);
|
|
1071
1122
|
const [targets, setTargets] = useState([]);
|
|
1072
1123
|
const code = ctx?.code ?? false;
|
|
1073
1124
|
const table = ctx?.table ?? false;
|
|
1125
|
+
const holdLastCode = tail && (ctx?.holdTailCode ?? false);
|
|
1074
1126
|
const inner = useMemo(() => ({ __html: html }), [html]);
|
|
1075
1127
|
useLayoutEffect(() => {
|
|
1076
1128
|
const root = ref.current;
|
|
@@ -1080,11 +1132,14 @@ function HtmlChunk({ html, fromMarkdown }) {
|
|
|
1080
1132
|
}
|
|
1081
1133
|
const found = [];
|
|
1082
1134
|
const selector = [code && "pre", table && "table"].filter(Boolean).join(",");
|
|
1135
|
+
const inProgress = holdLastCode ? Array.from(root.querySelectorAll("pre")).pop() : void 0;
|
|
1083
1136
|
for (const el of Array.from(root.querySelectorAll(selector))) {
|
|
1137
|
+
if (el === inProgress) continue;
|
|
1084
1138
|
const kind = el.tagName === "PRE" ? "code" : "table";
|
|
1085
1139
|
const wrapper = document.createElement("div");
|
|
1086
1140
|
wrapper.setAttribute("data-react-fancy-content-copy-block", kind);
|
|
1087
1141
|
wrapper.className = kind === "code" ? "group relative" : "group relative flex flex-col";
|
|
1142
|
+
wrapper.style.position = "relative";
|
|
1088
1143
|
const host = document.createElement("div");
|
|
1089
1144
|
host.setAttribute("data-react-fancy-content-copy-host", "");
|
|
1090
1145
|
host.className = kind === "code" ? "absolute right-2 top-2 z-10" : "flex justify-end";
|
|
@@ -1100,7 +1155,7 @@ function HtmlChunk({ html, fromMarkdown }) {
|
|
|
1100
1155
|
if (wrapper?.parentNode) wrapper.replaceWith(t.el);
|
|
1101
1156
|
}
|
|
1102
1157
|
};
|
|
1103
|
-
}, [html, code, table]);
|
|
1158
|
+
}, [html, code, table, holdLastCode]);
|
|
1104
1159
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1105
1160
|
/* @__PURE__ */ jsx("div", { ref, dangerouslySetInnerHTML: inner }),
|
|
1106
1161
|
targets.map(
|
|
@@ -1170,7 +1225,11 @@ function useCopyPipeline({
|
|
|
1170
1225
|
);
|
|
1171
1226
|
}
|
|
1172
1227
|
var MAX_DEPTH = 8;
|
|
1173
|
-
function
|
|
1228
|
+
function lastIndexWith(items, renders) {
|
|
1229
|
+
for (let i = items.length - 1; i >= 0; i--) if (renders(items[i])) return i;
|
|
1230
|
+
return -1;
|
|
1231
|
+
}
|
|
1232
|
+
function ContentBody({ source, format, extensions, unsafe, depth = 0, tail = false }) {
|
|
1174
1233
|
const active = depth >= MAX_DEPTH ? [] : extensions;
|
|
1175
1234
|
const blocks = useMemo(() => {
|
|
1176
1235
|
if (format !== "markdown") return null;
|
|
@@ -1179,8 +1238,19 @@ function ContentBody({ source, format, extensions, unsafe, depth = 0 }) {
|
|
|
1179
1238
|
}, [source, format, active]);
|
|
1180
1239
|
if (!blocks) {
|
|
1181
1240
|
const html = unsafe ? source : sanitizeHtml(source);
|
|
1182
|
-
return /* @__PURE__ */ jsx(
|
|
1241
|
+
return /* @__PURE__ */ jsx(
|
|
1242
|
+
RenderedContent,
|
|
1243
|
+
{
|
|
1244
|
+
html,
|
|
1245
|
+
extensions: active,
|
|
1246
|
+
unsafe,
|
|
1247
|
+
fromMarkdown: false,
|
|
1248
|
+
depth,
|
|
1249
|
+
tail
|
|
1250
|
+
}
|
|
1251
|
+
);
|
|
1183
1252
|
}
|
|
1253
|
+
const last = tail ? lastIndexWith(blocks, (b) => b.type === "tag" || b.source.trim() !== "") : -1;
|
|
1184
1254
|
return /* @__PURE__ */ jsx(Fragment, { children: blocks.map((block, i) => {
|
|
1185
1255
|
if (block.type === "markdown") {
|
|
1186
1256
|
const raw = markdownToRawHtml(block.source);
|
|
@@ -1192,7 +1262,8 @@ function ContentBody({ source, format, extensions, unsafe, depth = 0 }) {
|
|
|
1192
1262
|
extensions: active,
|
|
1193
1263
|
unsafe,
|
|
1194
1264
|
fromMarkdown: true,
|
|
1195
|
-
depth
|
|
1265
|
+
depth,
|
|
1266
|
+
tail: i === last
|
|
1196
1267
|
},
|
|
1197
1268
|
i
|
|
1198
1269
|
);
|
|
@@ -1208,21 +1279,38 @@ function ContentBody({ source, format, extensions, unsafe, depth = 0 }) {
|
|
|
1208
1279
|
format: "markdown",
|
|
1209
1280
|
extensions: active,
|
|
1210
1281
|
unsafe,
|
|
1211
|
-
depth: depth + 1
|
|
1282
|
+
depth: depth + 1,
|
|
1283
|
+
tail: i === last
|
|
1212
1284
|
}
|
|
1213
1285
|
) }) }, i);
|
|
1214
1286
|
}) });
|
|
1215
1287
|
}
|
|
1216
|
-
function RenderedContent({
|
|
1288
|
+
function RenderedContent({
|
|
1289
|
+
html,
|
|
1290
|
+
extensions,
|
|
1291
|
+
unsafe,
|
|
1292
|
+
fromMarkdown,
|
|
1293
|
+
depth,
|
|
1294
|
+
tail = false
|
|
1295
|
+
}) {
|
|
1217
1296
|
const segments = useMemo(() => parseSegments(html, extensions), [html, extensions]);
|
|
1218
1297
|
const renderHtml = (content) => unsafe ? content : sanitizeHtml(content);
|
|
1219
1298
|
if (segments.length === 0) return null;
|
|
1220
1299
|
if (segments.length === 1 && segments[0].type === "html") {
|
|
1221
|
-
return /* @__PURE__ */ jsx(HtmlChunk, { html: renderHtml(segments[0].content), fromMarkdown });
|
|
1300
|
+
return /* @__PURE__ */ jsx(HtmlChunk, { html: renderHtml(segments[0].content), fromMarkdown, tail });
|
|
1222
1301
|
}
|
|
1302
|
+
const last = tail ? lastIndexWith(segments, (s) => s.type === "extension" || s.content.trim() !== "") : -1;
|
|
1223
1303
|
return /* @__PURE__ */ jsx(Fragment, { children: segments.map((segment, i) => {
|
|
1224
1304
|
if (segment.type === "html") {
|
|
1225
|
-
return segment.content ? /* @__PURE__ */ jsx(
|
|
1305
|
+
return segment.content ? /* @__PURE__ */ jsx(
|
|
1306
|
+
HtmlChunk,
|
|
1307
|
+
{
|
|
1308
|
+
html: renderHtml(segment.content),
|
|
1309
|
+
fromMarkdown,
|
|
1310
|
+
tail: i === last
|
|
1311
|
+
},
|
|
1312
|
+
i
|
|
1313
|
+
) : null;
|
|
1226
1314
|
}
|
|
1227
1315
|
const ext = extensions.find((e) => e.tag.toLowerCase() === segment.tag);
|
|
1228
1316
|
if (!ext) return null;
|
|
@@ -1235,7 +1323,8 @@ function RenderedContent({ html, extensions, unsafe, fromMarkdown, depth }) {
|
|
|
1235
1323
|
format: "html",
|
|
1236
1324
|
extensions,
|
|
1237
1325
|
unsafe,
|
|
1238
|
-
depth: depth + 1
|
|
1326
|
+
depth: depth + 1,
|
|
1327
|
+
tail: i === last
|
|
1239
1328
|
}
|
|
1240
1329
|
) : void 0;
|
|
1241
1330
|
return /* @__PURE__ */ jsx(Wrapper, { "data-render-extension": segment.tag, children: /* @__PURE__ */ jsx(Component, { content: segment.content, attributes: segment.attributes, children }) }, i);
|
|
@@ -1261,15 +1350,14 @@ function ContentRenderer({
|
|
|
1261
1350
|
);
|
|
1262
1351
|
const safe = value ?? "";
|
|
1263
1352
|
const resolvedFormat = format === "auto" ? detectFormat(safe) : format;
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
);
|
|
1271
|
-
|
|
1272
|
-
}, [safe, streaming, extensions, resolvedFormat]);
|
|
1353
|
+
const progressive = streaming === "progressive";
|
|
1354
|
+
const { source, openFence } = useMemo(() => {
|
|
1355
|
+
if (!streaming) return { source: safe, openFence: false };
|
|
1356
|
+
const tags = extensions.map((e) => e.tag);
|
|
1357
|
+
const markdown = resolvedFormat === "markdown";
|
|
1358
|
+
if (progressive) return streamingProgressive(safe, tags, markdown);
|
|
1359
|
+
return { source: safe.slice(0, streamingCut(safe, tags, markdown)), openFence: false };
|
|
1360
|
+
}, [safe, streaming, progressive, extensions, resolvedFormat]);
|
|
1273
1361
|
const codeOn = copyButtons === true || typeof copyButtons === "object" && copyButtons.code !== false;
|
|
1274
1362
|
const tableOn = copyButtons === true || typeof copyButtons === "object" && copyButtons.table !== false;
|
|
1275
1363
|
const copyOn = codeOn || tableOn;
|
|
@@ -1281,16 +1369,18 @@ function ContentRenderer({
|
|
|
1281
1369
|
}, []);
|
|
1282
1370
|
const copy = useCopyPipeline({ writer: clipboardWriter, onCopy, rootRef, announce });
|
|
1283
1371
|
const copyContext = useMemo(
|
|
1284
|
-
() => ({ code: codeOn, table: tableOn, copy }),
|
|
1285
|
-
[codeOn, tableOn, copy]
|
|
1372
|
+
() => ({ code: codeOn, table: tableOn, copy, holdTailCode: openFence }),
|
|
1373
|
+
[codeOn, tableOn, copy, openFence]
|
|
1286
1374
|
);
|
|
1375
|
+
const contain = copyOn && cn("relative", className).split(" ").includes("relative");
|
|
1287
1376
|
return /* @__PURE__ */ jsxs(
|
|
1288
1377
|
"div",
|
|
1289
1378
|
{
|
|
1290
1379
|
ref: rootRef,
|
|
1291
1380
|
"data-react-fancy-content-renderer": "",
|
|
1292
1381
|
"data-streaming": streaming ? "true" : void 0,
|
|
1293
|
-
|
|
1382
|
+
"data-streaming-mode": progressive ? "progressive" : void 0,
|
|
1383
|
+
style: contain ? { lineHeight: lineSpacing, position: "relative" } : { lineHeight: lineSpacing },
|
|
1294
1384
|
className: cn("text-sm", proseClasses, className),
|
|
1295
1385
|
children: [
|
|
1296
1386
|
/* @__PURE__ */ jsx(CopyContext.Provider, { value: copyContext, children: /* @__PURE__ */ jsx(
|
|
@@ -1299,7 +1389,8 @@ function ContentRenderer({
|
|
|
1299
1389
|
source,
|
|
1300
1390
|
format: resolvedFormat,
|
|
1301
1391
|
extensions,
|
|
1302
|
-
unsafe
|
|
1392
|
+
unsafe,
|
|
1393
|
+
tail: true
|
|
1303
1394
|
}
|
|
1304
1395
|
) }),
|
|
1305
1396
|
copyOn && /* @__PURE__ */ jsx(
|
|
@@ -1310,6 +1401,7 @@ function ContentRenderer({
|
|
|
1310
1401
|
"aria-atomic": "true",
|
|
1311
1402
|
"data-react-fancy-content-renderer-live": "",
|
|
1312
1403
|
className: "sr-only",
|
|
1404
|
+
style: visuallyHidden,
|
|
1313
1405
|
children: announcement
|
|
1314
1406
|
}
|
|
1315
1407
|
)
|
|
@@ -1320,5 +1412,5 @@ function ContentRenderer({
|
|
|
1320
1412
|
ContentRenderer.displayName = "ContentRenderer";
|
|
1321
1413
|
|
|
1322
1414
|
export { ContentRenderer, detectFormat, extensionEditorClasses, htmlToMarkdown, markdownToEditorHtml, mergeExtensions, proseClasses, registerExtension, registerExtensions, renderMarkdown };
|
|
1323
|
-
//# sourceMappingURL=chunk-
|
|
1324
|
-
//# sourceMappingURL=chunk-
|
|
1415
|
+
//# sourceMappingURL=chunk-Z6RA37IC.js.map
|
|
1416
|
+
//# sourceMappingURL=chunk-Z6RA37IC.js.map
|