@drghaliasri/butex 6.1.2 → 6.1.4
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/README.md +2 -2
- package/dist/document2.js +109 -28
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +109 -28
- package/dist/document2.mjs.map +1 -1
- package/dist/react-document2.js +153 -48
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +153 -48
- package/dist/react-document2.mjs.map +1 -1
- package/package.json +2 -2
package/dist/react-document2.mjs
CHANGED
|
@@ -75,11 +75,6 @@ function butexFontDisplayTex(macro, text) {
|
|
|
75
75
|
function butexMaghribiDisplayTex(text) {
|
|
76
76
|
return butexFontDisplayTex("\\butexmaghribi", text);
|
|
77
77
|
}
|
|
78
|
-
function butexMaghribiDisplayLatex(text) {
|
|
79
|
-
return `\\[
|
|
80
|
-
${butexMaghribiDisplayTex(text)}
|
|
81
|
-
\\]`;
|
|
82
|
-
}
|
|
83
78
|
var BASMALA_LINES = [BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT];
|
|
84
79
|
function butexBasmalaDisplayTex() {
|
|
85
80
|
return BASMALA_LINES.map((line) => butexMaghribiDisplayTex(line)).join(" \\\\ ");
|
|
@@ -9642,7 +9637,43 @@ function styledTextLatex(text, style) {
|
|
|
9642
9637
|
}
|
|
9643
9638
|
return output;
|
|
9644
9639
|
}
|
|
9645
|
-
function
|
|
9640
|
+
function semanticRefPrefix(kind) {
|
|
9641
|
+
if (kind === "fig") {
|
|
9642
|
+
return "\u0627\u0644\u0634\u0643\u0644";
|
|
9643
|
+
}
|
|
9644
|
+
if (kind === "tab") {
|
|
9645
|
+
return "\u0627\u0644\u062C\u062F\u0648\u0644";
|
|
9646
|
+
}
|
|
9647
|
+
return "\u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629";
|
|
9648
|
+
}
|
|
9649
|
+
function semanticRefNames(kind) {
|
|
9650
|
+
if (kind === "fig") {
|
|
9651
|
+
return ["\u0627\u0644\u0634\u0643\u0644", "\u0634\u0643\u0644", "Figure", "figure"];
|
|
9652
|
+
}
|
|
9653
|
+
if (kind === "tab") {
|
|
9654
|
+
return ["\u0627\u0644\u062C\u062F\u0648\u0644", "\u062C\u062F\u0648\u0644", "Table", "table"];
|
|
9655
|
+
}
|
|
9656
|
+
return ["\u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629", "\u0645\u0639\u0627\u062F\u0644\u0629", "Equation", "equation"];
|
|
9657
|
+
}
|
|
9658
|
+
function previousTextAlreadyNamesKind(previousToken, kind) {
|
|
9659
|
+
if (previousToken?.kind !== "text") {
|
|
9660
|
+
return false;
|
|
9661
|
+
}
|
|
9662
|
+
const text = previousToken.text.trimEnd();
|
|
9663
|
+
return semanticRefNames(kind).some((name) => text.endsWith(name));
|
|
9664
|
+
}
|
|
9665
|
+
function refTokenLatexForDocument(token, labelKinds, previousToken) {
|
|
9666
|
+
const reference = refTokenLatex(token.keys, token.refCommand);
|
|
9667
|
+
if (!labelKinds || token.keys.length !== 1) {
|
|
9668
|
+
return reference;
|
|
9669
|
+
}
|
|
9670
|
+
const kind = labelKinds.get(token.keys[0]);
|
|
9671
|
+
if (!kind || previousTextAlreadyNamesKind(previousToken, kind)) {
|
|
9672
|
+
return reference;
|
|
9673
|
+
}
|
|
9674
|
+
return `${semanticRefPrefix(kind)}~${reference}`;
|
|
9675
|
+
}
|
|
9676
|
+
function tokenLatex(token, labelKinds, previousToken) {
|
|
9646
9677
|
if (token.kind === "text") {
|
|
9647
9678
|
return styledTextLatex(token.text, token.style);
|
|
9648
9679
|
}
|
|
@@ -9650,7 +9681,7 @@ function tokenLatex(token) {
|
|
|
9650
9681
|
return citeTokenLatex(token.keys);
|
|
9651
9682
|
}
|
|
9652
9683
|
if (token.kind === "ref") {
|
|
9653
|
-
return
|
|
9684
|
+
return refTokenLatexForDocument(token, labelKinds, previousToken);
|
|
9654
9685
|
}
|
|
9655
9686
|
if (token.display && token.labelEnabled && token.label && token.label.trim().length > 0) {
|
|
9656
9687
|
const body = mathBodyLatex(token);
|
|
@@ -9667,11 +9698,11 @@ ${body}
|
|
|
9667
9698
|
}
|
|
9668
9699
|
return renderMathNodeLatex(token.math);
|
|
9669
9700
|
}
|
|
9670
|
-
function
|
|
9671
|
-
return field.tokens.map((token) => tokenLatex(token)).join("");
|
|
9701
|
+
function inlineFieldLatexWithLabelKinds(field, labelKinds) {
|
|
9702
|
+
return field.tokens.map((token, index) => tokenLatex(token, labelKinds, field.tokens[index - 1])).join("");
|
|
9672
9703
|
}
|
|
9673
|
-
function textBlockLatex(block) {
|
|
9674
|
-
const content =
|
|
9704
|
+
function textBlockLatex(block, labelKinds) {
|
|
9705
|
+
const content = inlineFieldLatexWithLabelKinds(block.field, labelKinds);
|
|
9675
9706
|
const body = block.command === "\\paragraph" ? `\\par
|
|
9676
9707
|
${content}` : `${block.command}{${content}}`;
|
|
9677
9708
|
if (block.command === "\\paragraph" && block.centered) {
|
|
@@ -9684,38 +9715,61 @@ ${body}
|
|
|
9684
9715
|
function indent(value) {
|
|
9685
9716
|
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
9686
9717
|
}
|
|
9687
|
-
function listBlockLatex(block, references) {
|
|
9718
|
+
function listBlockLatex(block, references, labelKinds, fixedFloats) {
|
|
9688
9719
|
const items = block.items.map((item) => {
|
|
9689
|
-
const nested = item.blocks.map((child) => "\n" + indent(blockLatex(child, references))).join("");
|
|
9690
|
-
return ` \\item ${
|
|
9720
|
+
const nested = item.blocks.map((child) => "\n" + indent(blockLatex(child, references, labelKinds, fixedFloats))).join("");
|
|
9721
|
+
return ` \\item ${inlineFieldLatexWithLabelKinds(item.field, labelKinds)}${nested}`;
|
|
9691
9722
|
}).join("\n");
|
|
9692
9723
|
return `${block.command}
|
|
9693
9724
|
${items}
|
|
9694
9725
|
${block.closing}`;
|
|
9695
9726
|
}
|
|
9696
|
-
function
|
|
9697
|
-
const
|
|
9727
|
+
function defaultGridColumnSpec(block) {
|
|
9728
|
+
const compact = block.columns.replace(/\s+/g, "");
|
|
9729
|
+
const columnCount = block.rows[0]?.length ?? 0;
|
|
9730
|
+
if (columnCount === 0 || compact.length !== columnCount || !/^[lcr]+$/.test(compact)) {
|
|
9731
|
+
return null;
|
|
9732
|
+
}
|
|
9733
|
+
return `|${compact.split("").join("|")}|`;
|
|
9734
|
+
}
|
|
9735
|
+
function tabularInnerLatex(block, labelKinds) {
|
|
9736
|
+
const rows = block.rows.map(
|
|
9737
|
+
(row) => ` ${row.map((cell) => inlineFieldLatexWithLabelKinds(cell, labelKinds)).join(" & ")}`
|
|
9738
|
+
);
|
|
9739
|
+
const gridColumns = defaultGridColumnSpec(block);
|
|
9740
|
+
if (gridColumns) {
|
|
9741
|
+
const griddedRows = rows.map((row) => `${row} \\\\ \\hline`).join("\n");
|
|
9742
|
+
return `${block.command}{${gridColumns}}
|
|
9743
|
+
\\hline
|
|
9744
|
+
${griddedRows}
|
|
9745
|
+
${block.closing}`;
|
|
9746
|
+
}
|
|
9698
9747
|
return `${block.command}{${block.columns}}
|
|
9699
|
-
${rows}
|
|
9748
|
+
${rows.join(" \\\\\n")}
|
|
9700
9749
|
${block.closing}`;
|
|
9701
9750
|
}
|
|
9702
|
-
function floatCaptionLabelLines(block) {
|
|
9751
|
+
function floatCaptionLabelLines(block, counter) {
|
|
9703
9752
|
const lines = [];
|
|
9704
|
-
|
|
9753
|
+
const hasCaption = block.captionEnabled && block.caption.trim().length > 0;
|
|
9754
|
+
if (hasCaption) {
|
|
9705
9755
|
lines.push(` \\caption{${block.caption.trim()}}`);
|
|
9706
9756
|
}
|
|
9707
9757
|
if (block.labelEnabled && block.label.trim().length > 0) {
|
|
9758
|
+
if (!hasCaption) {
|
|
9759
|
+
lines.push(` \\refstepcounter{${counter}}`);
|
|
9760
|
+
}
|
|
9708
9761
|
lines.push(` \\label{${block.label.trim()}}`);
|
|
9709
9762
|
}
|
|
9710
9763
|
return lines;
|
|
9711
9764
|
}
|
|
9712
|
-
function tableBlockLatex(block) {
|
|
9713
|
-
const
|
|
9765
|
+
function tableBlockLatex(block, labelKinds, fixedFloats) {
|
|
9766
|
+
const placement = fixedFloats ? "H" : "htbp";
|
|
9767
|
+
const lines = [`\\begin{table}[${placement}]`];
|
|
9714
9768
|
if (block.centered) {
|
|
9715
9769
|
lines.push(" \\centering");
|
|
9716
9770
|
}
|
|
9717
|
-
lines.push(...floatCaptionLabelLines(block));
|
|
9718
|
-
lines.push(indent(tabularInnerLatex(block)));
|
|
9771
|
+
lines.push(...floatCaptionLabelLines(block, "table"));
|
|
9772
|
+
lines.push(indent(tabularInnerLatex(block, labelKinds)));
|
|
9719
9773
|
lines.push("\\end{table}");
|
|
9720
9774
|
return lines.join("\n");
|
|
9721
9775
|
}
|
|
@@ -9734,28 +9788,29 @@ function imageOptionsLatex(block, constrainToColumn) {
|
|
|
9734
9788
|
}
|
|
9735
9789
|
return `[${entries.map(([key, value]) => `${key}=${value}`).join(",")}]`;
|
|
9736
9790
|
}
|
|
9737
|
-
function imageBlockLatex(block) {
|
|
9738
|
-
const
|
|
9791
|
+
function imageBlockLatex(block, fixedFloats) {
|
|
9792
|
+
const placement = fixedFloats ? "H" : "htbp";
|
|
9793
|
+
const lines = [`\\begin{figure}[${placement}]`];
|
|
9739
9794
|
if (block.centered) {
|
|
9740
9795
|
lines.push(" \\centering");
|
|
9741
9796
|
}
|
|
9742
9797
|
lines.push(` ${block.command}${imageOptionsLatex(block, true)}{${block.value}}`);
|
|
9743
|
-
lines.push(...floatCaptionLabelLines(block));
|
|
9798
|
+
lines.push(...floatCaptionLabelLines(block, "figure"));
|
|
9744
9799
|
lines.push("\\end{figure}");
|
|
9745
9800
|
return lines.join("\n");
|
|
9746
9801
|
}
|
|
9747
|
-
function blockLatex(block, references) {
|
|
9802
|
+
function blockLatex(block, references, labelKinds, fixedFloats) {
|
|
9748
9803
|
if (block.kind === "textBlock") {
|
|
9749
|
-
return textBlockLatex(block);
|
|
9804
|
+
return textBlockLatex(block, labelKinds);
|
|
9750
9805
|
}
|
|
9751
9806
|
if (block.kind === "list") {
|
|
9752
|
-
return listBlockLatex(block, references);
|
|
9807
|
+
return listBlockLatex(block, references, labelKinds, fixedFloats);
|
|
9753
9808
|
}
|
|
9754
9809
|
if (block.kind === "table") {
|
|
9755
|
-
return tableBlockLatex(block);
|
|
9810
|
+
return tableBlockLatex(block, labelKinds, fixedFloats);
|
|
9756
9811
|
}
|
|
9757
9812
|
if (block.kind === "image") {
|
|
9758
|
-
return imageBlockLatex(block);
|
|
9813
|
+
return imageBlockLatex(block, fixedFloats);
|
|
9759
9814
|
}
|
|
9760
9815
|
if (block.kind === "bibliography") {
|
|
9761
9816
|
const width = String(Math.max(references.length, 9));
|
|
@@ -9797,12 +9852,29 @@ ${meta.abstract.trim()}
|
|
|
9797
9852
|
}
|
|
9798
9853
|
return parts;
|
|
9799
9854
|
}
|
|
9855
|
+
function documentLabelKindMap(document2) {
|
|
9856
|
+
const map = /* @__PURE__ */ new Map();
|
|
9857
|
+
for (const entry of collectDocument2Labels(document2)) {
|
|
9858
|
+
if (!map.has(entry.key)) {
|
|
9859
|
+
map.set(entry.key, entry.kind);
|
|
9860
|
+
}
|
|
9861
|
+
}
|
|
9862
|
+
return map;
|
|
9863
|
+
}
|
|
9864
|
+
function closingHamdalaLatex() {
|
|
9865
|
+
return `\\begin{center}
|
|
9866
|
+
\\maghribi{${BUTEX_CLOSING_HAMDALA}}
|
|
9867
|
+
\\end{center}`;
|
|
9868
|
+
}
|
|
9800
9869
|
function document2Latex(document2, options = {}) {
|
|
9801
9870
|
const meta = document2.meta ?? emptyDocument2Meta();
|
|
9802
9871
|
const twocolumn = options.twocolumn === true;
|
|
9803
9872
|
const front = articleFrontMatterLatex(meta);
|
|
9804
|
-
const
|
|
9805
|
-
const
|
|
9873
|
+
const labelKinds = documentLabelKindMap(document2);
|
|
9874
|
+
const bodyBlocks = document2.blocks.map(
|
|
9875
|
+
(block) => blockLatex(block, document2.references, labelKinds, twocolumn)
|
|
9876
|
+
);
|
|
9877
|
+
const closing = closingHamdalaLatex();
|
|
9806
9878
|
const body = [...front, ...bodyBlocks, closing].filter((part) => part.length > 0).join("\n\n");
|
|
9807
9879
|
const wrapDocument = options.wrapDocument !== false;
|
|
9808
9880
|
if (!wrapDocument) {
|
|
@@ -9811,10 +9883,11 @@ function document2Latex(document2, options = {}) {
|
|
|
9811
9883
|
|
|
9812
9884
|
${body}` : body;
|
|
9813
9885
|
}
|
|
9886
|
+
const floatPackage = twocolumn ? "\n\\usepackage{float}\n" : "\n";
|
|
9814
9887
|
const preamble = getArabicXeLatexPreamble({
|
|
9815
9888
|
digitsMapping: options.digitsMapping ?? digitsMappingFromDigitForm(options.digitForm),
|
|
9816
9889
|
twocolumn
|
|
9817
|
-
}) +
|
|
9890
|
+
}) + floatPackage + articleMaketitlePreamble(meta, twocolumn);
|
|
9818
9891
|
return `${preamble}
|
|
9819
9892
|
\\begin{document}
|
|
9820
9893
|
|
|
@@ -10412,6 +10485,15 @@ function document2Messages(locale) {
|
|
|
10412
10485
|
return DOCUMENT2_MESSAGES[locale];
|
|
10413
10486
|
}
|
|
10414
10487
|
|
|
10488
|
+
// src/react-document2/xelatexTextValidation.ts
|
|
10489
|
+
var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
10490
|
+
function hasXeLatexUnsupportedEmoji(value) {
|
|
10491
|
+
return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
|
|
10492
|
+
}
|
|
10493
|
+
function unsupportedEmojiMessage(uiLocale) {
|
|
10494
|
+
return uiLocale === "ar" ? "\u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u062A\u0639\u0628\u064A\u0631\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645." : "This emoji is not supported.";
|
|
10495
|
+
}
|
|
10496
|
+
|
|
10415
10497
|
// src/react-document2/ArticleMetaPanel.tsx
|
|
10416
10498
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10417
10499
|
var HIJRI_DAYS = Array.from({ length: 30 }, (_, index) => index + 1);
|
|
@@ -10419,6 +10501,20 @@ var HIJRI_YEARS = Array.from(
|
|
|
10419
10501
|
{ length: HIJRI_YEAR_MAX - HIJRI_YEAR_MIN + 1 },
|
|
10420
10502
|
(_, index) => HIJRI_YEAR_MIN + index
|
|
10421
10503
|
);
|
|
10504
|
+
var UNSUPPORTED_EMOJI_STYLE = {
|
|
10505
|
+
borderColor: "var(--butex-document2-error)",
|
|
10506
|
+
background: "var(--butex-document2-error-bg)"
|
|
10507
|
+
};
|
|
10508
|
+
function UnsupportedEmojiWarning({
|
|
10509
|
+
id,
|
|
10510
|
+
show,
|
|
10511
|
+
uiLocale
|
|
10512
|
+
}) {
|
|
10513
|
+
if (!show) {
|
|
10514
|
+
return null;
|
|
10515
|
+
}
|
|
10516
|
+
return /* @__PURE__ */ jsx("p", { id, className: "butex-document2-widget__field-error", children: unsupportedEmojiMessage(uiLocale) });
|
|
10517
|
+
}
|
|
10422
10518
|
function HijriDateMenu({
|
|
10423
10519
|
label,
|
|
10424
10520
|
value,
|
|
@@ -10496,6 +10592,12 @@ function ArticleMetaPanel({
|
|
|
10496
10592
|
const localRef = useRef(null);
|
|
10497
10593
|
const resolvedRef = panelRef ?? localRef;
|
|
10498
10594
|
const formattedDate = formatHijriDate(meta.date, { locale: uiLocale, digitForm });
|
|
10595
|
+
const titleUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.title);
|
|
10596
|
+
const authorsUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.authors);
|
|
10597
|
+
const abstractUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.abstract);
|
|
10598
|
+
const titleErrorId = "butex-document2-meta-title-unsupported-emoji";
|
|
10599
|
+
const authorsErrorId = "butex-document2-meta-authors-unsupported-emoji";
|
|
10600
|
+
const abstractErrorId = "butex-document2-meta-abstract-unsupported-emoji";
|
|
10499
10601
|
return /* @__PURE__ */ jsxs(
|
|
10500
10602
|
"section",
|
|
10501
10603
|
{
|
|
@@ -10522,12 +10624,16 @@ function ArticleMetaPanel({
|
|
|
10522
10624
|
{
|
|
10523
10625
|
ref: titleInputRef,
|
|
10524
10626
|
value: meta.title,
|
|
10627
|
+
"aria-invalid": titleUnsupportedEmoji ? true : void 0,
|
|
10628
|
+
"aria-describedby": titleUnsupportedEmoji ? titleErrorId : void 0,
|
|
10629
|
+
style: titleUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
|
|
10525
10630
|
onChange: (event) => {
|
|
10526
10631
|
const value = event.currentTarget.value;
|
|
10527
10632
|
onChange({ title: value });
|
|
10528
10633
|
}
|
|
10529
10634
|
}
|
|
10530
|
-
)
|
|
10635
|
+
),
|
|
10636
|
+
/* @__PURE__ */ jsx(UnsupportedEmojiWarning, { id: titleErrorId, show: titleUnsupportedEmoji, uiLocale })
|
|
10531
10637
|
] }),
|
|
10532
10638
|
/* @__PURE__ */ jsxs("label", { className: "butex-document2-widget__article-meta-field", children: [
|
|
10533
10639
|
/* @__PURE__ */ jsx("span", { children: messages.articleAuthors }),
|
|
@@ -10536,12 +10642,16 @@ function ArticleMetaPanel({
|
|
|
10536
10642
|
{
|
|
10537
10643
|
rows: 2,
|
|
10538
10644
|
value: meta.authors,
|
|
10645
|
+
"aria-invalid": authorsUnsupportedEmoji ? true : void 0,
|
|
10646
|
+
"aria-describedby": authorsUnsupportedEmoji ? authorsErrorId : void 0,
|
|
10647
|
+
style: authorsUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
|
|
10539
10648
|
onChange: (event) => {
|
|
10540
10649
|
const value = event.currentTarget.value;
|
|
10541
10650
|
onChange({ authors: value });
|
|
10542
10651
|
}
|
|
10543
10652
|
}
|
|
10544
|
-
)
|
|
10653
|
+
),
|
|
10654
|
+
/* @__PURE__ */ jsx(UnsupportedEmojiWarning, { id: authorsErrorId, show: authorsUnsupportedEmoji, uiLocale })
|
|
10545
10655
|
] }),
|
|
10546
10656
|
/* @__PURE__ */ jsxs("div", { className: "butex-document2-widget__article-meta-field", children: [
|
|
10547
10657
|
/* @__PURE__ */ jsx("span", { children: messages.articleDate }),
|
|
@@ -10592,12 +10702,16 @@ function ArticleMetaPanel({
|
|
|
10592
10702
|
{
|
|
10593
10703
|
rows: 3,
|
|
10594
10704
|
value: meta.abstract,
|
|
10705
|
+
"aria-invalid": abstractUnsupportedEmoji ? true : void 0,
|
|
10706
|
+
"aria-describedby": abstractUnsupportedEmoji ? abstractErrorId : void 0,
|
|
10707
|
+
style: abstractUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
|
|
10595
10708
|
onChange: (event) => {
|
|
10596
10709
|
const value = event.currentTarget.value;
|
|
10597
10710
|
onChange({ abstract: value });
|
|
10598
10711
|
}
|
|
10599
10712
|
}
|
|
10600
|
-
)
|
|
10713
|
+
),
|
|
10714
|
+
/* @__PURE__ */ jsx(UnsupportedEmojiWarning, { id: abstractErrorId, show: abstractUnsupportedEmoji, uiLocale })
|
|
10601
10715
|
] })
|
|
10602
10716
|
] }),
|
|
10603
10717
|
/* @__PURE__ */ jsx("p", { className: "butex-document2-widget__article-meta-fixed", dir: "rtl", children: BUTEX_CLOSING_HAMDALA })
|
|
@@ -11333,12 +11447,6 @@ function RefChip({
|
|
|
11333
11447
|
] });
|
|
11334
11448
|
}
|
|
11335
11449
|
|
|
11336
|
-
// src/react-document2/xelatexTextValidation.ts
|
|
11337
|
-
var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
11338
|
-
function hasXeLatexUnsupportedEmoji(value) {
|
|
11339
|
-
return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
|
|
11340
|
-
}
|
|
11341
|
-
|
|
11342
11450
|
// src/react-document2/InlineField.tsx
|
|
11343
11451
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
11344
11452
|
function rememberCaret(element, blockId, fieldId, tokenId, onFieldFocus) {
|
|
@@ -11358,9 +11466,6 @@ function fitTextareaHeight(element) {
|
|
|
11358
11466
|
element.style.height = "auto";
|
|
11359
11467
|
element.style.height = `${String(element.scrollHeight)}px`;
|
|
11360
11468
|
}
|
|
11361
|
-
function xeLatexUnsupportedEmojiMessage(uiLocale) {
|
|
11362
|
-
return uiLocale === "ar" ? "\u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632 \u0627\u0644\u062A\u0639\u0628\u064A\u0631\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u062A\u0635\u062F\u064A\u0631 XeLaTeX \u0627\u0644\u062D\u0627\u0644\u064A \u0628\u062E\u0637 Amiri." : "This emoji is not supported by the current XeLaTeX export using the Amiri font.";
|
|
11363
|
-
}
|
|
11364
11469
|
function InlineField({
|
|
11365
11470
|
field,
|
|
11366
11471
|
blockId,
|
|
@@ -11480,7 +11585,7 @@ function InlineField({
|
|
|
11480
11585
|
return /* @__PURE__ */ jsx6("div", { className: "butex-document2-widget__inline-field", dir: documentDirection, "data-document-direction": documentDirection, children: field.tokens.map((token) => {
|
|
11481
11586
|
if (token.kind === "text") {
|
|
11482
11587
|
const unsupportedEmoji = hasXeLatexUnsupportedEmoji(token.text);
|
|
11483
|
-
const errorId = `butex-document2-
|
|
11588
|
+
const errorId = `butex-document2-unsupported-emoji-${token.id}`;
|
|
11484
11589
|
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
11485
11590
|
/* @__PURE__ */ jsx6(
|
|
11486
11591
|
"textarea",
|
|
@@ -11561,7 +11666,7 @@ function InlineField({
|
|
|
11561
11666
|
id: errorId,
|
|
11562
11667
|
className: "butex-document2-widget__field-error",
|
|
11563
11668
|
style: { flexBasis: "100%" },
|
|
11564
|
-
children:
|
|
11669
|
+
children: unsupportedEmojiMessage(uiLocale)
|
|
11565
11670
|
}
|
|
11566
11671
|
) : null
|
|
11567
11672
|
] }, token.id);
|