@drghaliasri/butex 8.1.0 → 8.1.2
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/book.d.mts +362 -0
- package/dist/book.d.ts +362 -0
- package/dist/book.js +3270 -0
- package/dist/book.js.map +1 -0
- package/dist/book.mjs +3235 -0
- package/dist/book.mjs.map +1 -0
- package/dist/document-cli.js +625 -38
- package/dist/document-cli.js.map +1 -1
- package/dist/document.d.mts +47 -4
- package/dist/document.d.ts +47 -4
- package/dist/document.js +204 -36
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +198 -36
- package/dist/document.mjs.map +1 -1
- package/dist/react-book.d.mts +527 -0
- package/dist/react-book.d.ts +527 -0
- package/dist/react-book.js +23652 -0
- package/dist/react-book.js.map +1 -0
- package/dist/react-book.mjs +23633 -0
- package/dist/react-book.mjs.map +1 -0
- package/dist/react-document-preview.d.mts +28 -5
- package/dist/react-document-preview.d.ts +28 -5
- package/dist/react-document-preview.js +55 -10
- package/dist/react-document-preview.js.map +1 -1
- package/dist/react-document-preview.mjs +55 -10
- package/dist/react-document-preview.mjs.map +1 -1
- package/dist/react-document.d.mts +32 -3
- package/dist/react-document.d.ts +32 -3
- package/dist/react-document.js +282 -83
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +282 -83
- package/dist/react-document.mjs.map +1 -1
- package/package.json +11 -1
package/dist/react-document.js
CHANGED
|
@@ -875,11 +875,17 @@ function refTokenLatex(keys, refCommand) {
|
|
|
875
875
|
const command = refCommand === "eqref" ? "\\eqref" : "\\ref";
|
|
876
876
|
return `${command}{${keys.join(",")}}`;
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function implicitObjectKey(kind, ownerId, unitId) {
|
|
879
879
|
const hex = (value) => Array.from(new TextEncoder().encode(value), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
880
880
|
const scope = unitId === void 0 ? "a" : "u" + hex(unitId);
|
|
881
881
|
return kind + ":butex-auto-" + scope + "-" + hex(ownerId);
|
|
882
882
|
}
|
|
883
|
+
function implicitReferenceKey(kind, ownerId, unitId) {
|
|
884
|
+
return implicitObjectKey(kind, ownerId, unitId);
|
|
885
|
+
}
|
|
886
|
+
function implicitHeadingReferenceKey(kind, ownerId, unitId) {
|
|
887
|
+
return implicitObjectKey(kind, ownerId, unitId);
|
|
888
|
+
}
|
|
883
889
|
function supportsSingleEquationNumbering(token) {
|
|
884
890
|
return token.display && (token.opening === "\\[" || token.opening === String.fromCharCode(36, 36) || token.opening === "\\begin{equation}" || token.opening === "\\begin{equation*}");
|
|
885
891
|
}
|
|
@@ -1513,6 +1519,7 @@ function parseTextBlock(json, options, path, diagnostics, identities) {
|
|
|
1513
1519
|
identities
|
|
1514
1520
|
),
|
|
1515
1521
|
...metadataFromJson(json.metadata),
|
|
1522
|
+
...typeof json.label === "string" && json.command !== "\\paragraph" ? { label: json.label } : {},
|
|
1516
1523
|
...json.centered === true ? { centered: true } : {}
|
|
1517
1524
|
};
|
|
1518
1525
|
}
|
|
@@ -9531,6 +9538,24 @@ function updateDocumentTextBlockCentered(document2, blockId, centered) {
|
|
|
9531
9538
|
visit(next.blocks);
|
|
9532
9539
|
return next;
|
|
9533
9540
|
}
|
|
9541
|
+
function updateDocumentHeadingLabel(document2, blockId, label) {
|
|
9542
|
+
const next = cloneDocument(document2);
|
|
9543
|
+
function visit(blocks) {
|
|
9544
|
+
for (const block of blocks) {
|
|
9545
|
+
if (block.id === blockId && block.kind === "textBlock" && block.command !== "\\paragraph") {
|
|
9546
|
+
if (label.trim()) block.label = label.trim();
|
|
9547
|
+
else delete block.label;
|
|
9548
|
+
return true;
|
|
9549
|
+
}
|
|
9550
|
+
if (block.kind === "list") {
|
|
9551
|
+
for (const item of block.items) if (visit(item.blocks)) return true;
|
|
9552
|
+
}
|
|
9553
|
+
}
|
|
9554
|
+
return false;
|
|
9555
|
+
}
|
|
9556
|
+
visit(next.blocks);
|
|
9557
|
+
return next;
|
|
9558
|
+
}
|
|
9534
9559
|
function newListBlock(ordered) {
|
|
9535
9560
|
const command = ordered ? "\\begin{enumerate}" : "\\begin{itemize}";
|
|
9536
9561
|
const closing = ordered ? "\\end{enumerate}" : "\\end{itemize}";
|
|
@@ -10094,6 +10119,7 @@ function blockJson(block) {
|
|
|
10094
10119
|
id: block.id,
|
|
10095
10120
|
command: block.command,
|
|
10096
10121
|
...fieldJson(block.field),
|
|
10122
|
+
...block.command !== "\\paragraph" && block.label ? { label: block.label } : {},
|
|
10097
10123
|
...block.metadata ? { metadata: { ...block.metadata } } : {},
|
|
10098
10124
|
...block.command === "\\paragraph" ? { centered: block.centered === true } : {}
|
|
10099
10125
|
};
|
|
@@ -10485,7 +10511,7 @@ function refTokenLatexForDocument(token, labelKinds, previousToken) {
|
|
|
10485
10511
|
}
|
|
10486
10512
|
return `${semanticRefPrefix(kind)}~${reference}`;
|
|
10487
10513
|
}
|
|
10488
|
-
function tokenLatex(token, labelKinds, previousToken) {
|
|
10514
|
+
function tokenLatex(token, labelKinds, previousToken, unitId) {
|
|
10489
10515
|
if (token.kind === "text") {
|
|
10490
10516
|
return styledTextLatex(token.text, token.style);
|
|
10491
10517
|
}
|
|
@@ -10497,7 +10523,7 @@ function tokenLatex(token, labelKinds, previousToken) {
|
|
|
10497
10523
|
}
|
|
10498
10524
|
if (isNumberedEquation(token)) {
|
|
10499
10525
|
const body = mathBodyLatex(token);
|
|
10500
|
-
const autoKey = implicitReferenceKey("eq", token.id);
|
|
10526
|
+
const autoKey = implicitReferenceKey("eq", token.id, unitId);
|
|
10501
10527
|
const aliases = [autoKey];
|
|
10502
10528
|
if (token.labelEnabled && token.label?.trim() && token.label.trim() !== autoKey) aliases.push(token.label.trim());
|
|
10503
10529
|
return "\\begin{equation}\n" + body + "\n" + aliases.map((key) => "\\label{" + key + "}").join("\n") + "\n\\end{equation}";
|
|
@@ -10513,13 +10539,18 @@ function tokenLatex(token, labelKinds, previousToken) {
|
|
|
10513
10539
|
}
|
|
10514
10540
|
return renderMathNodeLatex(token.math);
|
|
10515
10541
|
}
|
|
10516
|
-
function inlineFieldLatexWithLabelKinds(field, labelKinds) {
|
|
10517
|
-
return field.tokens.map((token, index) => tokenLatex(token, labelKinds, field.tokens[index - 1])).join("");
|
|
10542
|
+
function inlineFieldLatexWithLabelKinds(field, labelKinds, unitId) {
|
|
10543
|
+
return field.tokens.map((token, index) => tokenLatex(token, labelKinds, field.tokens[index - 1], unitId)).join("");
|
|
10518
10544
|
}
|
|
10519
|
-
function textBlockLatex(block, labelKinds) {
|
|
10520
|
-
const content = inlineFieldLatexWithLabelKinds(block.field, labelKinds);
|
|
10545
|
+
function textBlockLatex(block, labelKinds, unitId) {
|
|
10546
|
+
const content = inlineFieldLatexWithLabelKinds(block.field, labelKinds, unitId);
|
|
10521
10547
|
const body = block.command === "\\paragraph" ? `\\par
|
|
10522
10548
|
${content}` : `${block.command}{${content}}`;
|
|
10549
|
+
if (block.command !== "\\paragraph") {
|
|
10550
|
+
const keys = unitId ? [implicitHeadingReferenceKey(block.command.slice(1), block.id, unitId)] : [];
|
|
10551
|
+
if (block.label?.trim() && !keys.includes(block.label.trim())) keys.push(block.label.trim());
|
|
10552
|
+
return [body, ...keys.map((key) => `\\label{${key}}`)].join("\n");
|
|
10553
|
+
}
|
|
10523
10554
|
if (block.command === "\\paragraph" && block.centered) {
|
|
10524
10555
|
return `\\begin{center}
|
|
10525
10556
|
${body}
|
|
@@ -10530,10 +10561,10 @@ ${body}
|
|
|
10530
10561
|
function indent(value) {
|
|
10531
10562
|
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
10532
10563
|
}
|
|
10533
|
-
function listBlockLatex(block, references, labelKinds, fixedFloats) {
|
|
10564
|
+
function listBlockLatex(block, references, labelKinds, fixedFloats, unitId) {
|
|
10534
10565
|
const items = block.items.map((item) => {
|
|
10535
|
-
const nested = item.blocks.map((child) => "\n" + indent(blockLatex(child, references, labelKinds, fixedFloats))).join("");
|
|
10536
|
-
return ` \\item ${inlineFieldLatexWithLabelKinds(item.field, labelKinds)}${nested}`;
|
|
10566
|
+
const nested = item.blocks.map((child) => "\n" + indent(blockLatex(child, references, labelKinds, fixedFloats, unitId))).join("");
|
|
10567
|
+
return ` \\item ${inlineFieldLatexWithLabelKinds(item.field, labelKinds, unitId)}${nested}`;
|
|
10537
10568
|
}).join("\n");
|
|
10538
10569
|
return `${block.command}
|
|
10539
10570
|
${items}
|
|
@@ -10547,9 +10578,9 @@ function defaultGridColumnSpec(block) {
|
|
|
10547
10578
|
}
|
|
10548
10579
|
return `|${compact.split("").join("|")}|`;
|
|
10549
10580
|
}
|
|
10550
|
-
function tabularInnerLatex(block, labelKinds) {
|
|
10581
|
+
function tabularInnerLatex(block, labelKinds, unitId) {
|
|
10551
10582
|
const rows = block.rows.map(
|
|
10552
|
-
(row) => ` ${row.map((cell) => inlineFieldLatexWithLabelKinds(cell, labelKinds)).join(" & ")}`
|
|
10583
|
+
(row) => ` ${row.map((cell) => inlineFieldLatexWithLabelKinds(cell, labelKinds, unitId)).join(" & ")}`
|
|
10553
10584
|
);
|
|
10554
10585
|
const gridColumns = defaultGridColumnSpec(block);
|
|
10555
10586
|
if (gridColumns) {
|
|
@@ -10563,9 +10594,9 @@ ${block.closing}`;
|
|
|
10563
10594
|
${rows.join(" \\\\\n")}
|
|
10564
10595
|
${block.closing}`;
|
|
10565
10596
|
}
|
|
10566
|
-
function floatCaptionLabelLines(block, counter, labelKinds) {
|
|
10597
|
+
function floatCaptionLabelLines(block, counter, labelKinds, unitId) {
|
|
10567
10598
|
const lines = [];
|
|
10568
|
-
const caption = inlineFieldLatexWithLabelKinds(block.captionField, labelKinds).trim();
|
|
10599
|
+
const caption = inlineFieldLatexWithLabelKinds(block.captionField, labelKinds, unitId).trim();
|
|
10569
10600
|
const hasCaption = block.captionEnabled && caption.length > 0;
|
|
10570
10601
|
if (hasCaption) {
|
|
10571
10602
|
lines.push(` \\caption{${caption}}`);
|
|
@@ -10573,20 +10604,20 @@ function floatCaptionLabelLines(block, counter, labelKinds) {
|
|
|
10573
10604
|
const hasManualLabel = block.labelEnabled && block.label.trim().length > 0;
|
|
10574
10605
|
if (hasCaption || hasManualLabel) {
|
|
10575
10606
|
if (!hasCaption) lines.push(" \\refstepcounter{" + counter + "}");
|
|
10576
|
-
const autoKey = implicitReferenceKey(counter === "figure" ? "fig" : "tab", block.id);
|
|
10607
|
+
const autoKey = implicitReferenceKey(counter === "figure" ? "fig" : "tab", block.id, unitId);
|
|
10577
10608
|
lines.push(" \\label{" + autoKey + "}");
|
|
10578
10609
|
if (hasManualLabel && block.label.trim() !== autoKey) lines.push(" \\label{" + block.label.trim() + "}");
|
|
10579
10610
|
}
|
|
10580
10611
|
return lines;
|
|
10581
10612
|
}
|
|
10582
|
-
function tableBlockLatex(block, labelKinds, fixedFloats) {
|
|
10613
|
+
function tableBlockLatex(block, labelKinds, fixedFloats, unitId) {
|
|
10583
10614
|
const placement = fixedFloats ? "H" : "htbp";
|
|
10584
10615
|
const lines = [`\\begin{table}[${placement}]`];
|
|
10585
10616
|
if (block.centered) {
|
|
10586
10617
|
lines.push(" \\centering");
|
|
10587
10618
|
}
|
|
10588
|
-
lines.push(...floatCaptionLabelLines(block, "table", labelKinds));
|
|
10589
|
-
lines.push(indent(tabularInnerLatex(block, labelKinds)));
|
|
10619
|
+
lines.push(...floatCaptionLabelLines(block, "table", labelKinds, unitId));
|
|
10620
|
+
lines.push(indent(tabularInnerLatex(block, labelKinds, unitId)));
|
|
10590
10621
|
lines.push("\\end{table}");
|
|
10591
10622
|
return lines.join("\n");
|
|
10592
10623
|
}
|
|
@@ -10605,29 +10636,29 @@ function imageOptionsLatex(block, constrainToColumn) {
|
|
|
10605
10636
|
}
|
|
10606
10637
|
return `[${entries.map(([key, value]) => `${key}=${value}`).join(",")}]`;
|
|
10607
10638
|
}
|
|
10608
|
-
function imageBlockLatex(block, labelKinds, fixedFloats) {
|
|
10639
|
+
function imageBlockLatex(block, labelKinds, fixedFloats, unitId) {
|
|
10609
10640
|
const placement = fixedFloats ? "H" : "htbp";
|
|
10610
10641
|
const lines = [`\\begin{figure}[${placement}]`];
|
|
10611
10642
|
if (block.centered) {
|
|
10612
10643
|
lines.push(" \\centering");
|
|
10613
10644
|
}
|
|
10614
10645
|
lines.push(` ${block.command}${imageOptionsLatex(block, true)}{${block.value}}`);
|
|
10615
|
-
lines.push(...floatCaptionLabelLines(block, "figure", labelKinds));
|
|
10646
|
+
lines.push(...floatCaptionLabelLines(block, "figure", labelKinds, unitId));
|
|
10616
10647
|
lines.push("\\end{figure}");
|
|
10617
10648
|
return lines.join("\n");
|
|
10618
10649
|
}
|
|
10619
|
-
function blockLatex(block, references, labelKinds, fixedFloats) {
|
|
10650
|
+
function blockLatex(block, references, labelKinds, fixedFloats, unitId) {
|
|
10620
10651
|
if (block.kind === "textBlock") {
|
|
10621
|
-
return textBlockLatex(block, labelKinds);
|
|
10652
|
+
return textBlockLatex(block, labelKinds, unitId);
|
|
10622
10653
|
}
|
|
10623
10654
|
if (block.kind === "list") {
|
|
10624
|
-
return listBlockLatex(block, references, labelKinds, fixedFloats);
|
|
10655
|
+
return listBlockLatex(block, references, labelKinds, fixedFloats, unitId);
|
|
10625
10656
|
}
|
|
10626
10657
|
if (block.kind === "table") {
|
|
10627
|
-
return tableBlockLatex(block, labelKinds, fixedFloats);
|
|
10658
|
+
return tableBlockLatex(block, labelKinds, fixedFloats, unitId);
|
|
10628
10659
|
}
|
|
10629
10660
|
if (block.kind === "image") {
|
|
10630
|
-
return imageBlockLatex(block, labelKinds, fixedFloats);
|
|
10661
|
+
return imageBlockLatex(block, labelKinds, fixedFloats, unitId);
|
|
10631
10662
|
}
|
|
10632
10663
|
if (block.kind === "bibliography") {
|
|
10633
10664
|
const width = String(Math.max(references.length, 9));
|
|
@@ -10681,6 +10712,17 @@ function closingHamdalaLatex() {
|
|
|
10681
10712
|
\\maghribi{${BUTEX_CLOSING_HAMDALA}}
|
|
10682
10713
|
\\end{center}`;
|
|
10683
10714
|
}
|
|
10715
|
+
function documentContentLatex(document2, context) {
|
|
10716
|
+
if (!context?.unitId?.trim()) throw new Error("book-content export requires a stable unitId");
|
|
10717
|
+
const labelKinds = documentLabelKindMap(document2);
|
|
10718
|
+
for (const target of context?.targets ?? []) {
|
|
10719
|
+
if (target.kind === "fig" || target.kind === "tab" || target.kind === "eq") {
|
|
10720
|
+
labelKinds.set(target.key, target.kind);
|
|
10721
|
+
if (target.manualKey) labelKinds.set(target.manualKey, target.kind);
|
|
10722
|
+
}
|
|
10723
|
+
}
|
|
10724
|
+
return document2.blocks.filter((block) => block.kind !== "bibliography").map((block) => blockLatex(block, document2.references, labelKinds, false, context?.unitId)).filter((part) => part.length > 0).join("\n\n");
|
|
10725
|
+
}
|
|
10684
10726
|
function documentLatex(document2, options = {}) {
|
|
10685
10727
|
const meta = document2.meta ?? emptyDocumentMeta();
|
|
10686
10728
|
const twocolumn = options.twocolumn === true;
|
|
@@ -10712,6 +10754,65 @@ ${body}
|
|
|
10712
10754
|
`;
|
|
10713
10755
|
}
|
|
10714
10756
|
|
|
10757
|
+
// src/document/bookContent.ts
|
|
10758
|
+
function bookContextReferences(context) {
|
|
10759
|
+
return (context?.references ?? []).map((entry, index) => ({
|
|
10760
|
+
...referenceFromJson(entry),
|
|
10761
|
+
id: "book-ref-" + String(index)
|
|
10762
|
+
}));
|
|
10763
|
+
}
|
|
10764
|
+
function bookContentTargets(document2, context) {
|
|
10765
|
+
const local = collectDocumentReferenceTargets(document2).map((target) => {
|
|
10766
|
+
const key = implicitReferenceKey(target.kind, target.ownerId, context.unitId);
|
|
10767
|
+
const projection = context.targets?.find((entry) => entry.unitId === context.unitId && (entry.ownerId === target.ownerId || entry.key === key));
|
|
10768
|
+
return {
|
|
10769
|
+
...target,
|
|
10770
|
+
key,
|
|
10771
|
+
...projection?.displayLabel ? { displayLabel: projection.displayLabel } : {}
|
|
10772
|
+
};
|
|
10773
|
+
});
|
|
10774
|
+
const headings = document2.blocks.flatMap((block) => {
|
|
10775
|
+
if (block.kind !== "textBlock" || block.command === "\\paragraph") return [];
|
|
10776
|
+
const kind = block.command.slice(1);
|
|
10777
|
+
const caption = block.field.tokens.filter((token) => token.kind === "text").map((token) => token.text).join("");
|
|
10778
|
+
return [{
|
|
10779
|
+
unitId: context.unitId,
|
|
10780
|
+
ownerId: block.id,
|
|
10781
|
+
kind,
|
|
10782
|
+
key: implicitHeadingReferenceKey(kind, block.id, context.unitId),
|
|
10783
|
+
caption,
|
|
10784
|
+
number: null,
|
|
10785
|
+
displayLabel: context.targets?.find((target) => target.unitId === context.unitId && target.ownerId === block.id)?.displayLabel ?? (caption || kind),
|
|
10786
|
+
...block.label ? { manualKey: block.label } : {}
|
|
10787
|
+
}];
|
|
10788
|
+
});
|
|
10789
|
+
const external = (context.targets ?? []).filter((target) => target.unitId !== context.unitId).map((target) => ({
|
|
10790
|
+
...target,
|
|
10791
|
+
caption: target.caption ?? "",
|
|
10792
|
+
number: null
|
|
10793
|
+
}));
|
|
10794
|
+
return [...local, ...headings, ...external];
|
|
10795
|
+
}
|
|
10796
|
+
function formatBookReferenceLabel(keys, document2, command, context, options = {}) {
|
|
10797
|
+
const targets = context.targets ?? [];
|
|
10798
|
+
return keys.map((key) => {
|
|
10799
|
+
const target = targets.find((entry) => entry.key === key || entry.manualKey === key);
|
|
10800
|
+
if (target?.displayLabel) return target.displayLabel;
|
|
10801
|
+
const local = collectDocumentReferenceTargets(document2).find((entry) => entry.manualKey === key || implicitReferenceKey(entry.kind, entry.ownerId, context.unitId) === key);
|
|
10802
|
+
if (local) return formatRefLabel([local.manualKey || local.key], document2, command, options);
|
|
10803
|
+
const heading = document2.blocks.find((block) => block.kind === "textBlock" && block.command !== "\\paragraph" && (block.label === key || implicitHeadingReferenceKey(
|
|
10804
|
+
block.command.slice(1),
|
|
10805
|
+
block.id,
|
|
10806
|
+
context.unitId
|
|
10807
|
+
) === key));
|
|
10808
|
+
if (heading?.kind === "textBlock") {
|
|
10809
|
+
const caption = heading.field.tokens.filter((token) => token.kind === "text").map((token) => token.text).join("").trim();
|
|
10810
|
+
return caption || heading.command.slice(1);
|
|
10811
|
+
}
|
|
10812
|
+
return command === "eqref" ? "(?)" : "?";
|
|
10813
|
+
}).join(options.documentDirection === "ltr" ? ", " : "\u060C");
|
|
10814
|
+
}
|
|
10815
|
+
|
|
10715
10816
|
// src/document/validation.ts
|
|
10716
10817
|
var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
10717
10818
|
function hasXeLatexUnsupportedEmoji(value) {
|
|
@@ -10795,6 +10896,13 @@ function validateInlineField(context, field, path, blockId) {
|
|
|
10795
10896
|
function validateBlock(context, block, path) {
|
|
10796
10897
|
if (block.kind === "textBlock") {
|
|
10797
10898
|
validateInlineField(context, block.field, `${path}.field`, block.id);
|
|
10899
|
+
if (block.command !== "\\paragraph") {
|
|
10900
|
+
const kind = block.command.slice(1);
|
|
10901
|
+
if (block.label) registerKey(context, block.label, `${path}.label`, kind, block.id);
|
|
10902
|
+
if (context.bookMode && context.bookContext) {
|
|
10903
|
+
context.labelKinds.set(implicitHeadingReferenceKey(kind, block.id, context.bookContext.unitId), kind);
|
|
10904
|
+
}
|
|
10905
|
+
}
|
|
10798
10906
|
return;
|
|
10799
10907
|
}
|
|
10800
10908
|
if (block.kind === "list") {
|
|
@@ -10844,6 +10952,10 @@ function validateBlock(context, block, path) {
|
|
|
10844
10952
|
}
|
|
10845
10953
|
return;
|
|
10846
10954
|
}
|
|
10955
|
+
if (block.kind === "bibliography" && context.bookMode) {
|
|
10956
|
+
addIssue(context, "book_local_bibliography", path, block.id);
|
|
10957
|
+
return;
|
|
10958
|
+
}
|
|
10847
10959
|
if (block.kind === "raw") {
|
|
10848
10960
|
validateTextValue(context, block.value, `${path}.value`, block.id);
|
|
10849
10961
|
}
|
|
@@ -10866,7 +10978,7 @@ function validateDuplicateKeys(context) {
|
|
|
10866
10978
|
}
|
|
10867
10979
|
function validatePendingReferences(context) {
|
|
10868
10980
|
for (const pending of context.pendingCitations) {
|
|
10869
|
-
if (pending.token.keys.some((key) => !isValidDocumentKey(normalizeDocumentKey(key)))) {
|
|
10981
|
+
if (pending.token.keys.some((key) => !isValidDocumentKey(normalizeDocumentKey(key)) || context.citationKeys !== void 0 && !context.citationKeys.has(normalizeDocumentKey(key)))) {
|
|
10870
10982
|
addIssue(
|
|
10871
10983
|
context,
|
|
10872
10984
|
"missing_citation",
|
|
@@ -10948,7 +11060,7 @@ function resolveDocument(document2) {
|
|
|
10948
11060
|
return null;
|
|
10949
11061
|
}
|
|
10950
11062
|
}
|
|
10951
|
-
function validateDocument(document2) {
|
|
11063
|
+
function validateDocument(document2, options = {}) {
|
|
10952
11064
|
const resolved = resolveDocument(document2);
|
|
10953
11065
|
if (!resolved) {
|
|
10954
11066
|
return {
|
|
@@ -10960,6 +11072,9 @@ function validateDocument(document2) {
|
|
|
10960
11072
|
issues: [],
|
|
10961
11073
|
keyOwners: [],
|
|
10962
11074
|
labelKinds: /* @__PURE__ */ new Map(),
|
|
11075
|
+
bookMode: options.mode === "book-content",
|
|
11076
|
+
bookContext: options.bookContext,
|
|
11077
|
+
...options.mode === "book-content" && options.bookContext?.references ? { citationKeys: new Set(options.bookContext.references.map((entry) => normalizeDocumentKey(entry.key))) } : {},
|
|
10963
11078
|
pendingCitations: [],
|
|
10964
11079
|
pendingReferences: []
|
|
10965
11080
|
};
|
|
@@ -10979,10 +11094,11 @@ function validateDocument(document2) {
|
|
|
10979
11094
|
validateBlock(context, block, `$.blocks[${String(index)}]`);
|
|
10980
11095
|
});
|
|
10981
11096
|
for (const target of collectDocumentReferenceTargets(resolved)) {
|
|
10982
|
-
|
|
11097
|
+
const autoKey = context.bookMode && context.bookContext ? implicitReferenceKey(target.kind, target.ownerId, context.bookContext.unitId) : target.key;
|
|
11098
|
+
if (target.number !== null && target.manualKey !== autoKey) {
|
|
10983
11099
|
registerKey(
|
|
10984
11100
|
context,
|
|
10985
|
-
|
|
11101
|
+
autoKey,
|
|
10986
11102
|
"$.automatic_labels",
|
|
10987
11103
|
target.kind,
|
|
10988
11104
|
target.kind === "eq" ? void 0 : target.ownerId,
|
|
@@ -10990,6 +11106,15 @@ function validateDocument(document2) {
|
|
|
10990
11106
|
);
|
|
10991
11107
|
}
|
|
10992
11108
|
}
|
|
11109
|
+
if (context.bookMode) {
|
|
11110
|
+
for (const target of context.bookContext?.targets ?? []) {
|
|
11111
|
+
context.labelKinds.set(normalizeDocumentKey(target.key), target.kind);
|
|
11112
|
+
if (target.manualKey) context.labelKinds.set(normalizeDocumentKey(target.manualKey), target.kind);
|
|
11113
|
+
}
|
|
11114
|
+
}
|
|
11115
|
+
if (context.bookMode && !context.bookContext?.unitId?.trim()) {
|
|
11116
|
+
addIssue(context, "book_context_required", "$.book_context");
|
|
11117
|
+
}
|
|
10993
11118
|
for (const diagnostic of resolved.diagnostics) {
|
|
10994
11119
|
addIssue(context, "parser_diagnostic", diagnostic.path);
|
|
10995
11120
|
}
|
|
@@ -11000,9 +11125,6 @@ function validateDocument(document2) {
|
|
|
11000
11125
|
issues: context.issues
|
|
11001
11126
|
};
|
|
11002
11127
|
}
|
|
11003
|
-
function isDocumentValid(document2) {
|
|
11004
|
-
return validateDocument(document2).valid;
|
|
11005
|
-
}
|
|
11006
11128
|
|
|
11007
11129
|
// src/document/history.ts
|
|
11008
11130
|
var DEFAULT_DOCUMENT_HISTORY_MAX_DEPTH = 100;
|
|
@@ -11112,7 +11234,7 @@ function previewInlines(field, islands, output, equationSide, document2, preview
|
|
|
11112
11234
|
kind: "cite",
|
|
11113
11235
|
id: token.id,
|
|
11114
11236
|
keys: [...token.keys],
|
|
11115
|
-
label: formatCiteLabel(token.keys, document2.references, {
|
|
11237
|
+
label: formatCiteLabel(token.keys, previewOptions.mode === "book-content" ? bookContextReferences(previewOptions.bookContext) : document2.references, {
|
|
11116
11238
|
documentDirection: previewOptions.documentDirection,
|
|
11117
11239
|
digitForm: previewOptions.digitForm
|
|
11118
11240
|
})
|
|
@@ -11124,7 +11246,10 @@ function previewInlines(field, islands, output, equationSide, document2, preview
|
|
|
11124
11246
|
id: token.id,
|
|
11125
11247
|
keys: [...token.keys],
|
|
11126
11248
|
refCommand: token.refCommand,
|
|
11127
|
-
label:
|
|
11249
|
+
label: previewOptions.mode === "book-content" && previewOptions.bookContext ? formatBookReferenceLabel(token.keys, document2, token.refCommand, previewOptions.bookContext, {
|
|
11250
|
+
documentDirection: previewOptions.documentDirection,
|
|
11251
|
+
digitForm: previewOptions.digitForm
|
|
11252
|
+
}) : formatRefLabel(token.keys, document2, token.refCommand, {
|
|
11128
11253
|
documentDirection: previewOptions.documentDirection,
|
|
11129
11254
|
digitForm: previewOptions.digitForm
|
|
11130
11255
|
})
|
|
@@ -11280,14 +11405,16 @@ function documentPreview(document2, output = "svg", equationSide = "arabic", pre
|
|
|
11280
11405
|
const options = {
|
|
11281
11406
|
documentDirection: previewOptions.documentDirection ?? "rtl",
|
|
11282
11407
|
digitForm: previewOptions.digitForm ?? (previewOptions.documentDirection === "ltr" ? "western" : "arabicIndic"),
|
|
11283
|
-
uiLocale: previewOptions.uiLocale ?? "ar"
|
|
11408
|
+
uiLocale: previewOptions.uiLocale ?? "ar",
|
|
11409
|
+
mode: previewOptions.mode ?? "article",
|
|
11410
|
+
bookContext: previewOptions.bookContext
|
|
11284
11411
|
};
|
|
11285
|
-
const body = document2.blocks.map((block) => blockPreview(block, mathIslands, output, equationSide, document2, options));
|
|
11412
|
+
const body = document2.blocks.filter((block) => options.mode !== "book-content" || block.kind !== "bibliography").map((block) => blockPreview(block, mathIslands, output, equationSide, document2, options));
|
|
11286
11413
|
return {
|
|
11287
11414
|
blocks: [
|
|
11288
|
-
...articleChromePreview(document2, options.uiLocale ?? "ar", options),
|
|
11415
|
+
...options.mode === "book-content" ? [] : articleChromePreview(document2, options.uiLocale ?? "ar", options),
|
|
11289
11416
|
...body,
|
|
11290
|
-
{ kind: "closing", id: "article-closing", text: BUTEX_CLOSING_HAMDALA, tex: butexMaghribiDisplayTex(BUTEX_CLOSING_HAMDALA) }
|
|
11417
|
+
...options.mode === "book-content" ? [] : [{ kind: "closing", id: "article-closing", text: BUTEX_CLOSING_HAMDALA, tex: butexMaghribiDisplayTex(BUTEX_CLOSING_HAMDALA) }]
|
|
11291
11418
|
],
|
|
11292
11419
|
mathIslands
|
|
11293
11420
|
};
|
|
@@ -12520,6 +12647,7 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
|
12520
12647
|
function RefChip({
|
|
12521
12648
|
token,
|
|
12522
12649
|
document: document2,
|
|
12650
|
+
bookContext,
|
|
12523
12651
|
documentDirection = "rtl",
|
|
12524
12652
|
digitForm,
|
|
12525
12653
|
editable = true,
|
|
@@ -12531,7 +12659,7 @@ function RefChip({
|
|
|
12531
12659
|
onRequestTextFocus
|
|
12532
12660
|
}) {
|
|
12533
12661
|
const messages = documentMessages(uiLocale);
|
|
12534
|
-
const label = formatRefLabel(token.keys, document2, token.refCommand, { documentDirection, digitForm });
|
|
12662
|
+
const label = bookContext ? formatBookReferenceLabel(token.keys, document2, token.refCommand, bookContext, { documentDirection, digitForm }) : formatRefLabel(token.keys, document2, token.refCommand, { documentDirection, digitForm });
|
|
12535
12663
|
const forwardArrowKey = documentDirection === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
12536
12664
|
const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
12537
12665
|
if (!editable) {
|
|
@@ -12609,6 +12737,7 @@ function InlineField({
|
|
|
12609
12737
|
blockId,
|
|
12610
12738
|
references = [],
|
|
12611
12739
|
documentNode,
|
|
12740
|
+
bookContext,
|
|
12612
12741
|
documentDirection = "rtl",
|
|
12613
12742
|
digitForm,
|
|
12614
12743
|
mathOutput = "svg",
|
|
@@ -12845,6 +12974,7 @@ function InlineField({
|
|
|
12845
12974
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
12846
12975
|
RefChip,
|
|
12847
12976
|
{
|
|
12977
|
+
bookContext,
|
|
12848
12978
|
token,
|
|
12849
12979
|
document: documentNode,
|
|
12850
12980
|
documentDirection,
|
|
@@ -13327,7 +13457,9 @@ function BlockEditor({
|
|
|
13327
13457
|
onParagraphCenteredChange,
|
|
13328
13458
|
onAddListItem,
|
|
13329
13459
|
onRemoveListItem,
|
|
13330
|
-
onManageReferences
|
|
13460
|
+
onManageReferences,
|
|
13461
|
+
bookContext,
|
|
13462
|
+
onHeadingLabelChange
|
|
13331
13463
|
}) {
|
|
13332
13464
|
const messages = documentMessages(uiLocale);
|
|
13333
13465
|
const labels = documentNode ? collectDocumentLabels(documentNode) : [];
|
|
@@ -13342,6 +13474,7 @@ function BlockEditor({
|
|
|
13342
13474
|
blockId: block.id,
|
|
13343
13475
|
references,
|
|
13344
13476
|
documentNode,
|
|
13477
|
+
bookContext,
|
|
13345
13478
|
documentDirection,
|
|
13346
13479
|
digitForm,
|
|
13347
13480
|
mathOutput,
|
|
@@ -13419,6 +13552,18 @@ function BlockEditor({
|
|
|
13419
13552
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
13420
13553
|
header,
|
|
13421
13554
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InlineField, { field: block.field, ...fieldProps }),
|
|
13555
|
+
bookContext && block.command !== "\\paragraph" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "butex-document-widget__refs-field", children: [
|
|
13556
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: messages.floatLabel }),
|
|
13557
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
13558
|
+
"input",
|
|
13559
|
+
{
|
|
13560
|
+
type: "text",
|
|
13561
|
+
dir: "ltr",
|
|
13562
|
+
value: block.label ?? "",
|
|
13563
|
+
onChange: (event) => onHeadingLabelChange?.(block.id, event.currentTarget.value)
|
|
13564
|
+
}
|
|
13565
|
+
)
|
|
13566
|
+
] }) : null,
|
|
13422
13567
|
block.command === "\\paragraph" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "butex-document-widget__float-meta butex-document-widget__float-meta--compact", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "butex-document-widget__float-meta-toggle", children: [
|
|
13423
13568
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
13424
13569
|
"input",
|
|
@@ -13478,7 +13623,9 @@ function BlockEditor({
|
|
|
13478
13623
|
onParagraphCenteredChange,
|
|
13479
13624
|
onAddListItem,
|
|
13480
13625
|
onRemoveListItem,
|
|
13481
|
-
onManageReferences
|
|
13626
|
+
onManageReferences,
|
|
13627
|
+
bookContext,
|
|
13628
|
+
onHeadingLabelChange
|
|
13482
13629
|
},
|
|
13483
13630
|
child.id
|
|
13484
13631
|
))
|
|
@@ -13838,6 +13985,7 @@ function digitFormLabel(digitForm) {
|
|
|
13838
13985
|
return "456";
|
|
13839
13986
|
}
|
|
13840
13987
|
function DocumentInsertToolbar({
|
|
13988
|
+
mode = "article",
|
|
13841
13989
|
canUndo,
|
|
13842
13990
|
canRedo,
|
|
13843
13991
|
editableEquations = true,
|
|
@@ -14027,7 +14175,7 @@ function DocumentInsertToolbar({
|
|
|
14027
14175
|
)
|
|
14028
14176
|
] }),
|
|
14029
14177
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document-widget__toolbar-group", role: "group", "aria-label": messages.structure, children: [
|
|
14030
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
14178
|
+
mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
14031
14179
|
"button",
|
|
14032
14180
|
{
|
|
14033
14181
|
type: "button",
|
|
@@ -14037,7 +14185,7 @@ function DocumentInsertToolbar({
|
|
|
14037
14185
|
onClick: onOpenArticleMeta,
|
|
14038
14186
|
children: "\u2726"
|
|
14039
14187
|
}
|
|
14040
|
-
),
|
|
14188
|
+
) : null,
|
|
14041
14189
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "butex-document-widget__icon-btn butex-document-widget__icon-btn--h1", title: messages.addSection, "aria-label": messages.addSection, onClick: onAddSection, children: messages.sectionGlyph }),
|
|
14042
14190
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "butex-document-widget__icon-btn butex-document-widget__icon-btn--h2", title: messages.addSubsection, "aria-label": messages.addSubsection, onClick: onAddSubsection, children: messages.subsectionGlyph }),
|
|
14043
14191
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "butex-document-widget__icon-btn butex-document-widget__icon-btn--h3", title: messages.addSubsubsection, "aria-label": messages.addSubsubsection, onClick: onAddSubsubsection, children: messages.subsubsectionGlyph }),
|
|
@@ -14112,14 +14260,14 @@ function DocumentInsertToolbar({
|
|
|
14112
14260
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\xA7" }),
|
|
14113
14261
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: messages.insertInternalRef })
|
|
14114
14262
|
] }),
|
|
14115
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "menuitem", title: messages.insertBibliography, onClick: () => runReferenceAction(onInsertBibliography), children: [
|
|
14263
|
+
mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "menuitem", title: messages.insertBibliography, onClick: () => runReferenceAction(onInsertBibliography), children: [
|
|
14116
14264
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "butex-document-widget__icon-bibliography", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { viewBox: "0 0 16 16", width: "14", height: "14", focusable: "false", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { fill: "currentColor", d: "M2.2 2.4h7.2c.9 0 1.6.7 1.6 1.6v9.2c0 .5-.6.8-1 .5l-2.2-1.6H2.2c-.9 0-1.6-.7-1.6-1.6V4c0-.9.7-1.6 1.6-1.6zm0 1.2c-.2 0-.4.2-.4.4v6.5c0 .2.2.4.4.4h6.1l1.5 1.1V4c0-.2-.2-.4-.4-.4H2.2zM3.4 5.2h5.2v1H3.4zm0 2.1h4.2v1H3.4zm0 2.1h3.4v1H3.4zM11.4 4.1h2.2c.8 0 1.4.6 1.4 1.4v7.1c0 .4-.5.7-.8.4l-1.7-1.3h-1.1V4.1zm1.2 1.2v5.4l.7.5V5.5c0-.1-.1-.2-.2-.2h-.5z" }) }) }),
|
|
14117
14265
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: messages.insertBibliography })
|
|
14118
|
-
] }),
|
|
14119
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "menuitem", title: messages.manageReferences, onClick: () => runReferenceAction(onManageReferences), children: [
|
|
14266
|
+
] }) : null,
|
|
14267
|
+
mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "menuitem", title: messages.manageReferences, onClick: () => runReferenceAction(onManageReferences), children: [
|
|
14120
14268
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2630" }),
|
|
14121
14269
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: messages.manageReferences })
|
|
14122
|
-
] }),
|
|
14270
|
+
] }) : null,
|
|
14123
14271
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", role: "menuitem", title: messages.manageLabels, onClick: () => runReferenceAction(onManageLabels), children: [
|
|
14124
14272
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2317" }),
|
|
14125
14273
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: messages.manageLabels })
|
|
@@ -14151,6 +14299,7 @@ function digitFormLabel2(digitForm) {
|
|
|
14151
14299
|
return "456";
|
|
14152
14300
|
}
|
|
14153
14301
|
function DocumentMobileToolbar({
|
|
14302
|
+
mode = "article",
|
|
14154
14303
|
mobileView,
|
|
14155
14304
|
canUndo,
|
|
14156
14305
|
canRedo,
|
|
@@ -14335,7 +14484,7 @@ function DocumentMobileToolbar({
|
|
|
14335
14484
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "butex-document-widget__command-group", "aria-labelledby": `${titleId}-structure`, children: [
|
|
14336
14485
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { id: `${titleId}-structure`, children: messages.structure }),
|
|
14337
14486
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "butex-document-widget__command-grid", children: [
|
|
14338
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onOpenArticleMeta), children: messages.articleMetaTitle }),
|
|
14487
|
+
mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onOpenArticleMeta), children: messages.articleMetaTitle }) : null,
|
|
14339
14488
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onAddSection), children: messages.addSection }),
|
|
14340
14489
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onAddSubsection), children: messages.addSubsection }),
|
|
14341
14490
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onAddSubsubsection), children: messages.addSubsubsection }),
|
|
@@ -14376,8 +14525,8 @@ function DocumentMobileToolbar({
|
|
|
14376
14525
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "butex-document-widget__command-grid", children: [
|
|
14377
14526
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onInsertCitation, false), children: messages.insertCitation }),
|
|
14378
14527
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onInsertInternalRef, false), children: messages.insertInternalRef }),
|
|
14379
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onInsertBibliography), children: messages.insertBibliography }),
|
|
14380
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(() => onManageReferences(triggerRef.current), false), children: messages.manageReferences }),
|
|
14528
|
+
mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(onInsertBibliography), children: messages.insertBibliography }) : null,
|
|
14529
|
+
mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(() => onManageReferences(triggerRef.current), false), children: messages.manageReferences }) : null,
|
|
14381
14530
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => runAction(() => onManageLabels(triggerRef.current), false), children: messages.manageLabels })
|
|
14382
14531
|
] })
|
|
14383
14532
|
] }),
|
|
@@ -19173,15 +19322,15 @@ function RefPickerPopover({
|
|
|
19173
19322
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: messages.refPickerTitle }),
|
|
19174
19323
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", "data-dialog-initial-focus": true, className: "butex-document-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
|
|
19175
19324
|
] }),
|
|
19176
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "butex-document-widget__dialog-body", children: targets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "butex-document-widget__cite-picker-empty", children: messages.noLabelsYet }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "butex-document-widget__cite-picker-list", children: targets.filter((entry) => entry.number !== null || entry.kind === "eq").map((entry) => {
|
|
19325
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "butex-document-widget__dialog-body", children: targets.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "butex-document-widget__cite-picker-empty", children: messages.noLabelsYet }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "butex-document-widget__cite-picker-list", children: targets.filter((entry) => entry.number !== null || Boolean(entry.displayLabel) || entry.kind === "eq").map((entry) => {
|
|
19177
19326
|
const checked = selected.includes(entry.key) || Boolean(entry.manualKey && selected.includes(entry.manualKey));
|
|
19178
|
-
const title = entry.number === null ? uiLocale === "ar" ? "\u0645\u0639\u0627\u062F\u0644\u0629 \u063A\u064A\u0631 \u0645\u0631\u0642\u0645\u0629" : "Unnumbered equation" : formatFloatCaptionTitle(entry.kind, entry.number, {
|
|
19327
|
+
const title = entry.displayLabel ?? (entry.number === null ? uiLocale === "ar" ? "\u0645\u0639\u0627\u062F\u0644\u0629 \u063A\u064A\u0631 \u0645\u0631\u0642\u0645\u0629" : "Unnumbered equation" : formatFloatCaptionTitle(entry.kind, entry.number, {
|
|
19179
19328
|
uiLocale,
|
|
19180
19329
|
digitForm,
|
|
19181
19330
|
documentDirection
|
|
19182
|
-
});
|
|
19331
|
+
}));
|
|
19183
19332
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: "butex-document-widget__cite-picker-item", children: [
|
|
19184
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "radio", name: "butex-ref-key", checked, disabled: entry.number === null, onChange: () => selectKey(entry.key, entry.kind) }),
|
|
19333
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "radio", name: "butex-ref-key", checked, disabled: entry.number === null && !entry.displayLabel, onChange: () => selectKey(entry.key, entry.kind) }),
|
|
19185
19334
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
|
|
19186
19335
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: entry.kind === "eq" && entry.number !== null ? title.replace(/(\d+|[٠-٩]+)$/, "($1)") : title }),
|
|
19187
19336
|
entry.caption ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "butex-document-widget__cite-picker-meta", children: entry.caption }) : null,
|
|
@@ -21830,6 +21979,8 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
21830
21979
|
function ButexDocumentEditor2({
|
|
21831
21980
|
initialDocument,
|
|
21832
21981
|
documentMeta,
|
|
21982
|
+
mode = "article",
|
|
21983
|
+
bookContext,
|
|
21833
21984
|
className,
|
|
21834
21985
|
debug = false,
|
|
21835
21986
|
documentDirection = "rtl",
|
|
@@ -21878,6 +22029,27 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
21878
22029
|
return setCurrentDigitForm(session, digitForm);
|
|
21879
22030
|
}
|
|
21880
22031
|
const historyRef = (0, import_react17.useRef)(createDocumentHistory());
|
|
22032
|
+
const selectedMathRef = (0, import_react17.useRef)(selectedMath);
|
|
22033
|
+
selectedMathRef.current = selectedMath;
|
|
22034
|
+
const imagePickCountRef = (0, import_react17.useRef)(0);
|
|
22035
|
+
const documentGenerationRef = (0, import_react17.useRef)(0);
|
|
22036
|
+
(0, import_react17.useEffect)(() => {
|
|
22037
|
+
documentGenerationRef.current += 1;
|
|
22038
|
+
return () => {
|
|
22039
|
+
documentGenerationRef.current += 1;
|
|
22040
|
+
};
|
|
22041
|
+
}, [initialDocument]);
|
|
22042
|
+
const safeRequestImagePick = (0, import_react17.useCallback)(async (ctx) => {
|
|
22043
|
+
if (!onRequestImagePick) return null;
|
|
22044
|
+
const generation = documentGenerationRef.current;
|
|
22045
|
+
imagePickCountRef.current += 1;
|
|
22046
|
+
try {
|
|
22047
|
+
const picked = await onRequestImagePick(ctx);
|
|
22048
|
+
return generation === documentGenerationRef.current ? picked : null;
|
|
22049
|
+
} finally {
|
|
22050
|
+
imagePickCountRef.current -= 1;
|
|
22051
|
+
}
|
|
22052
|
+
}, [onRequestImagePick]);
|
|
21881
22053
|
const documentRef = (0, import_react17.useRef)(documentNode);
|
|
21882
22054
|
const editorFocusRef = (0, import_react17.useRef)(editorFocus);
|
|
21883
22055
|
const textSnapshotArmedRef = (0, import_react17.useRef)(false);
|
|
@@ -21902,17 +22074,26 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
21902
22074
|
}
|
|
21903
22075
|
documentRef.current = documentNode;
|
|
21904
22076
|
editorFocusRef.current = editorFocus;
|
|
21905
|
-
const latex = documentLatex(documentNode, { digitForm });
|
|
22077
|
+
const latex = mode === "book-content" ? documentContentLatex(documentNode, bookContext) : documentLatex(documentNode, { digitForm });
|
|
21906
22078
|
const documentJson = (0, import_react17.useMemo)(() => toDocumentJson(documentNode), [documentNode]);
|
|
21907
22079
|
const documentLabels = (0, import_react17.useMemo)(() => collectDocumentLabels(documentNode), [documentNode]);
|
|
21908
|
-
const
|
|
22080
|
+
const displayReferences = (0, import_react17.useMemo)(
|
|
22081
|
+
() => mode === "book-content" ? bookContextReferences(bookContext) : documentNode.references,
|
|
22082
|
+
[mode, bookContext, documentNode]
|
|
22083
|
+
);
|
|
22084
|
+
const referenceTargets = (0, import_react17.useMemo)(
|
|
22085
|
+
() => mode === "book-content" && bookContext ? bookContentTargets(documentNode, bookContext) : collectDocumentReferenceTargets(documentNode),
|
|
22086
|
+
[mode, bookContext, documentNode]
|
|
22087
|
+
);
|
|
21909
22088
|
const preview = (0, import_react17.useMemo)(
|
|
21910
22089
|
() => documentPreview(documentNode, mathOutput, equationSide, {
|
|
21911
22090
|
documentDirection,
|
|
21912
22091
|
digitForm,
|
|
21913
|
-
uiLocale
|
|
22092
|
+
uiLocale,
|
|
22093
|
+
mode,
|
|
22094
|
+
bookContext
|
|
21914
22095
|
}),
|
|
21915
|
-
[documentNode, documentDirection, digitForm, equationSide, mathOutput, uiLocale]
|
|
22096
|
+
[documentNode, documentDirection, digitForm, equationSide, mathOutput, uiLocale, mode, bookContext]
|
|
21916
22097
|
);
|
|
21917
22098
|
const debugEnabled = (0, import_react17.useMemo)(() => {
|
|
21918
22099
|
if (debug) {
|
|
@@ -22039,11 +22220,11 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22039
22220
|
setHistoryTick((tick) => tick + 1);
|
|
22040
22221
|
}, []);
|
|
22041
22222
|
const applyDocument = (0, import_react17.useCallback)(
|
|
22042
|
-
(next,
|
|
22043
|
-
if (
|
|
22223
|
+
(next, mode2 = "immediate") => {
|
|
22224
|
+
if (mode2 === "immediate") {
|
|
22044
22225
|
pushDocumentSnapshot(historyRef.current, documentRef.current);
|
|
22045
22226
|
bumpHistoryUi();
|
|
22046
|
-
} else if (
|
|
22227
|
+
} else if (mode2 === "text") {
|
|
22047
22228
|
if (!textSnapshotArmedRef.current) {
|
|
22048
22229
|
pushDocumentSnapshot(historyRef.current, documentRef.current);
|
|
22049
22230
|
textSnapshotArmedRef.current = true;
|
|
@@ -22082,6 +22263,9 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22082
22263
|
},
|
|
22083
22264
|
getDocumentJson() {
|
|
22084
22265
|
return toDocumentJson(documentRef.current);
|
|
22266
|
+
},
|
|
22267
|
+
hasPendingChildTransaction() {
|
|
22268
|
+
return selectedMathRef.current !== null || imagePickCountRef.current > 0;
|
|
22085
22269
|
}
|
|
22086
22270
|
}),
|
|
22087
22271
|
[applyDocument, insertImageBlock]
|
|
@@ -22219,7 +22403,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22219
22403
|
function onFieldBlur() {
|
|
22220
22404
|
textSnapshotArmedRef.current = false;
|
|
22221
22405
|
}
|
|
22222
|
-
function openNewEquation(
|
|
22406
|
+
function openNewEquation(mode2) {
|
|
22223
22407
|
if (!editableEquations) {
|
|
22224
22408
|
return;
|
|
22225
22409
|
}
|
|
@@ -22237,7 +22421,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22237
22421
|
fieldId: target?.fieldId ?? null,
|
|
22238
22422
|
textTokenId: target?.textTokenId ?? null,
|
|
22239
22423
|
insertAt: target?.caretOffset ?? 0,
|
|
22240
|
-
mathMode:
|
|
22424
|
+
mathMode: mode2,
|
|
22241
22425
|
session: equationSessionWithDocumentDigits(createEmptyEquationSession(equationSide)),
|
|
22242
22426
|
reason: null,
|
|
22243
22427
|
labelEnabled: false,
|
|
@@ -22256,14 +22440,14 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22256
22440
|
editorFocus: { ...editorFocusRef.current }
|
|
22257
22441
|
};
|
|
22258
22442
|
const result = mathTokenToEditorSession(token.math, equationSide);
|
|
22259
|
-
const
|
|
22443
|
+
const mode2 = token.display ? "display" : "inline";
|
|
22260
22444
|
if (!result.editable) {
|
|
22261
22445
|
setSelectedMath({
|
|
22262
22446
|
tokenId: token.id,
|
|
22263
22447
|
fieldId: null,
|
|
22264
22448
|
insertAt: 0,
|
|
22265
22449
|
textTokenId: null,
|
|
22266
|
-
mathMode:
|
|
22450
|
+
mathMode: mode2,
|
|
22267
22451
|
session: equationSessionWithDocumentDigits(createEmptyEquationSession(equationSide)),
|
|
22268
22452
|
reason: result.reason,
|
|
22269
22453
|
labelEnabled: Boolean(token.labelEnabled),
|
|
@@ -22277,7 +22461,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22277
22461
|
fieldId: null,
|
|
22278
22462
|
insertAt: 0,
|
|
22279
22463
|
textTokenId: null,
|
|
22280
|
-
mathMode:
|
|
22464
|
+
mathMode: mode2,
|
|
22281
22465
|
session: equationSessionWithDocumentDigits(result.session),
|
|
22282
22466
|
reason: null,
|
|
22283
22467
|
labelEnabled: Boolean(token.labelEnabled),
|
|
@@ -22602,6 +22786,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22602
22786
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
22603
22787
|
DocumentInsertToolbar,
|
|
22604
22788
|
{
|
|
22789
|
+
mode,
|
|
22605
22790
|
canUndo,
|
|
22606
22791
|
canRedo,
|
|
22607
22792
|
editableEquations,
|
|
@@ -22640,6 +22825,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22640
22825
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
22641
22826
|
DocumentMobileToolbar,
|
|
22642
22827
|
{
|
|
22828
|
+
mode,
|
|
22643
22829
|
mobileView,
|
|
22644
22830
|
canUndo,
|
|
22645
22831
|
canRedo,
|
|
@@ -22711,7 +22897,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22711
22897
|
"aria-label": messages.documentEditor,
|
|
22712
22898
|
"aria-hidden": !showEditorPanel,
|
|
22713
22899
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "butex-document-widget__blocks", children: [
|
|
22714
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
22900
|
+
mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
22715
22901
|
ArticleMetaPanel,
|
|
22716
22902
|
{
|
|
22717
22903
|
meta: documentNode.meta ?? emptyDocumentMeta(),
|
|
@@ -22723,13 +22909,16 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22723
22909
|
applyDocument(updateDocumentMeta(documentRef.current, patch), "text");
|
|
22724
22910
|
}
|
|
22725
22911
|
}
|
|
22726
|
-
),
|
|
22912
|
+
) : null,
|
|
22913
|
+
mode === "book-content" && documentNode.blocks.some((block) => block.kind === "bibliography") ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { role: "alert", className: "butex-document-widget__error", children: uiLocale === "ar" ? "\u062A\u0633\u062A\u062E\u062F\u0645 \u0641\u0635\u0648\u0644 \u0627\u0644\u0643\u062A\u0627\u0628 \u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0627\u062C\u0639 \u0645\u0634\u062A\u0631\u0643\u0629\u061B \u0623\u0632\u0644 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0631\u0627\u062C\u0639 \u0627\u0644\u0645\u062D\u0644\u064A\u0629 \u0645\u0646 \u0627\u0644\u0641\u0635\u0644." : "Book chapters use the shared bibliography. Remove the local bibliography block." }) : null,
|
|
22727
22914
|
documentNode.blocks.map((block, blockIndex) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
22728
22915
|
BlockEditor,
|
|
22729
22916
|
{
|
|
22730
22917
|
block,
|
|
22731
|
-
references:
|
|
22918
|
+
references: displayReferences,
|
|
22732
22919
|
documentNode,
|
|
22920
|
+
bookContext: mode === "book-content" ? bookContext : void 0,
|
|
22921
|
+
onHeadingLabelChange: (blockId, label) => applyDocument(updateDocumentHeadingLabel(documentRef.current, blockId, label), "text"),
|
|
22733
22922
|
documentDirection,
|
|
22734
22923
|
digitForm,
|
|
22735
22924
|
mathOutput,
|
|
@@ -22768,7 +22957,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22768
22957
|
applyDocument(clearDocumentImageAsset(documentRef.current, blockId), "immediate");
|
|
22769
22958
|
},
|
|
22770
22959
|
resolveImageUrl,
|
|
22771
|
-
onRequestImagePick,
|
|
22960
|
+
onRequestImagePick: onRequestImagePick ? safeRequestImagePick : void 0,
|
|
22772
22961
|
listImageAssets,
|
|
22773
22962
|
renderImageBlockEditor,
|
|
22774
22963
|
onFloatMetaChange: (blockId, kind, patch) => {
|
|
@@ -22790,7 +22979,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22790
22979
|
clearBlockSelection();
|
|
22791
22980
|
applyDocument(removeDocumentListItem(documentRef.current, listBlockId, itemId), "immediate");
|
|
22792
22981
|
},
|
|
22793
|
-
onManageReferences: () => openReferencesManager()
|
|
22982
|
+
onManageReferences: mode === "article" ? () => openReferencesManager() : void 0
|
|
22794
22983
|
},
|
|
22795
22984
|
block.id
|
|
22796
22985
|
))
|
|
@@ -22881,11 +23070,11 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22881
23070
|
numbered: selectedMath.numbered,
|
|
22882
23071
|
onNumberedChange: (numbered) => setSelectedMath((current) => current ? { ...current, numbered } : current),
|
|
22883
23072
|
labels: documentLabels,
|
|
22884
|
-
references:
|
|
23073
|
+
references: displayReferences,
|
|
22885
23074
|
ownerId: selectedMath.tokenId ?? void 0,
|
|
22886
23075
|
onLabelEnabledChange: (enabled) => setSelectedMath((current) => current ? { ...current, labelEnabled: enabled, numbered: enabled || current.numbered } : current),
|
|
22887
23076
|
onLabelChange: (nextLabel) => setSelectedMath((current) => current ? { ...current, label: nextLabel } : current),
|
|
22888
|
-
onMathModeChange: (
|
|
23077
|
+
onMathModeChange: (mode2) => setSelectedMath((current) => current ? { ...current, mathMode: mode2 } : current),
|
|
22889
23078
|
onClose: closeEquationAndRestoreOrigin,
|
|
22890
23079
|
onSave: saveEquation,
|
|
22891
23080
|
onDelete: deleteSelectedEquation
|
|
@@ -22895,16 +23084,16 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22895
23084
|
CitePickerPopover,
|
|
22896
23085
|
{
|
|
22897
23086
|
open: citePicker !== null,
|
|
22898
|
-
references:
|
|
23087
|
+
references: displayReferences,
|
|
22899
23088
|
initialKeys: citePicker?.keys ?? [],
|
|
22900
23089
|
uiLocale,
|
|
22901
23090
|
digitForm,
|
|
22902
23091
|
onClose: () => setCitePicker(null),
|
|
22903
23092
|
onConfirm: confirmCiteKeys,
|
|
22904
|
-
onManageReferences: () => {
|
|
23093
|
+
onManageReferences: mode === "article" ? () => {
|
|
22905
23094
|
setCitePicker(null);
|
|
22906
23095
|
openReferencesManager();
|
|
22907
|
-
}
|
|
23096
|
+
} : void 0
|
|
22908
23097
|
}
|
|
22909
23098
|
) : null,
|
|
22910
23099
|
!previewOnly ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -22927,7 +23116,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22927
23116
|
}
|
|
22928
23117
|
}
|
|
22929
23118
|
) : null,
|
|
22930
|
-
!previewOnly ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
23119
|
+
!previewOnly && mode === "article" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
22931
23120
|
ReferencesPanel,
|
|
22932
23121
|
{
|
|
22933
23122
|
open: referencesOpen,
|
|
@@ -22948,7 +23137,7 @@ var ButexDocumentEditor = (0, import_react17.forwardRef)(
|
|
|
22948
23137
|
{
|
|
22949
23138
|
open: labelsOpen,
|
|
22950
23139
|
labels: documentLabels,
|
|
22951
|
-
references:
|
|
23140
|
+
references: displayReferences,
|
|
22952
23141
|
uiLocale,
|
|
22953
23142
|
digitForm,
|
|
22954
23143
|
returnFocusRef: managerFocusOriginRef,
|
|
@@ -22985,6 +23174,8 @@ var ButexDocumentEditor3 = (0, import_react18.forwardRef)(
|
|
|
22985
23174
|
function ValidatedButexDocumentEditor({
|
|
22986
23175
|
initialDocument,
|
|
22987
23176
|
uiLocale = "ar",
|
|
23177
|
+
mode = "article",
|
|
23178
|
+
bookContext,
|
|
22988
23179
|
onDocumentChange,
|
|
22989
23180
|
onValidityChange,
|
|
22990
23181
|
renderImageBlockEditor,
|
|
@@ -23013,10 +23204,10 @@ var ButexDocumentEditor3 = (0, import_react18.forwardRef)(
|
|
|
23013
23204
|
(document2) => {
|
|
23014
23205
|
const validationTarget = initialDocument !== void 0 && (malformedInitialDocument || awaitingInitialResolutionRef.current) ? initialDocument : document2;
|
|
23015
23206
|
awaitingInitialResolutionRef.current = false;
|
|
23016
|
-
emitValidity(
|
|
23207
|
+
emitValidity(validateDocument(validationTarget, { mode, bookContext }).valid);
|
|
23017
23208
|
onDocumentChange?.(document2);
|
|
23018
23209
|
},
|
|
23019
|
-
[emitValidity, initialDocument, malformedInitialDocument, onDocumentChange]
|
|
23210
|
+
[emitValidity, initialDocument, malformedInitialDocument, onDocumentChange, mode, bookContext]
|
|
23020
23211
|
);
|
|
23021
23212
|
const handleImageBlockEditor = (0, import_react18.useCallback)(
|
|
23022
23213
|
(ctx) => {
|
|
@@ -23053,6 +23244,8 @@ var ButexDocumentEditor3 = (0, import_react18.forwardRef)(
|
|
|
23053
23244
|
...rest,
|
|
23054
23245
|
initialDocument,
|
|
23055
23246
|
uiLocale,
|
|
23247
|
+
mode,
|
|
23248
|
+
bookContext,
|
|
23056
23249
|
onDocumentChange: handleDocumentChange,
|
|
23057
23250
|
renderImageBlockEditor: handleImageBlockEditor
|
|
23058
23251
|
}
|
|
@@ -23095,6 +23288,8 @@ function resolvePreviewDocument(input, uiLocale = "ar") {
|
|
|
23095
23288
|
}
|
|
23096
23289
|
}
|
|
23097
23290
|
function ButexDocumentPreview({
|
|
23291
|
+
mode = "article",
|
|
23292
|
+
bookContext,
|
|
23098
23293
|
document: document2,
|
|
23099
23294
|
className,
|
|
23100
23295
|
documentDirection = "rtl",
|
|
@@ -23113,7 +23308,9 @@ function ButexDocumentPreview({
|
|
|
23113
23308
|
preview: documentPreview(resolved.document, mathOutput, equationSide, {
|
|
23114
23309
|
documentDirection,
|
|
23115
23310
|
digitForm: resolvedDigitForm,
|
|
23116
|
-
uiLocale
|
|
23311
|
+
uiLocale,
|
|
23312
|
+
mode,
|
|
23313
|
+
bookContext
|
|
23117
23314
|
}),
|
|
23118
23315
|
error: resolved.error
|
|
23119
23316
|
};
|
|
@@ -23123,12 +23320,14 @@ function ButexDocumentPreview({
|
|
|
23123
23320
|
preview: documentPreview(createEmptyDocument(), mathOutput, equationSide, {
|
|
23124
23321
|
documentDirection,
|
|
23125
23322
|
digitForm: resolvedDigitForm,
|
|
23126
|
-
uiLocale
|
|
23323
|
+
uiLocale,
|
|
23324
|
+
mode,
|
|
23325
|
+
bookContext
|
|
23127
23326
|
}),
|
|
23128
23327
|
error: `${messages.loadDocumentError}: ${detail}`
|
|
23129
23328
|
};
|
|
23130
23329
|
}
|
|
23131
|
-
}, [documentDirection, equationSide, mathOutput, messages.loadDocumentError, resolved, resolvedDigitForm, uiLocale]);
|
|
23330
|
+
}, [bookContext, mode, documentDirection, equationSide, mathOutput, messages.loadDocumentError, resolved, resolvedDigitForm, uiLocale]);
|
|
23132
23331
|
(0, import_react19.useEffect)(() => {
|
|
23133
23332
|
injectBuTeXDocumentStyles();
|
|
23134
23333
|
}, []);
|