@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.js
CHANGED
|
@@ -110,11 +110,6 @@ function butexFontDisplayTex(macro, text) {
|
|
|
110
110
|
function butexMaghribiDisplayTex(text) {
|
|
111
111
|
return butexFontDisplayTex("\\butexmaghribi", text);
|
|
112
112
|
}
|
|
113
|
-
function butexMaghribiDisplayLatex(text) {
|
|
114
|
-
return `\\[
|
|
115
|
-
${butexMaghribiDisplayTex(text)}
|
|
116
|
-
\\]`;
|
|
117
|
-
}
|
|
118
113
|
var BASMALA_LINES = [BUTEX_BASMALA_LINE1, BUTEX_BASMALA_LINE2, BUTEX_BASMALA_SALAWAT];
|
|
119
114
|
function butexBasmalaDisplayTex() {
|
|
120
115
|
return BASMALA_LINES.map((line) => butexMaghribiDisplayTex(line)).join(" \\\\ ");
|
|
@@ -9677,7 +9672,43 @@ function styledTextLatex(text, style) {
|
|
|
9677
9672
|
}
|
|
9678
9673
|
return output;
|
|
9679
9674
|
}
|
|
9680
|
-
function
|
|
9675
|
+
function semanticRefPrefix(kind) {
|
|
9676
|
+
if (kind === "fig") {
|
|
9677
|
+
return "\u0627\u0644\u0634\u0643\u0644";
|
|
9678
|
+
}
|
|
9679
|
+
if (kind === "tab") {
|
|
9680
|
+
return "\u0627\u0644\u062C\u062F\u0648\u0644";
|
|
9681
|
+
}
|
|
9682
|
+
return "\u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629";
|
|
9683
|
+
}
|
|
9684
|
+
function semanticRefNames(kind) {
|
|
9685
|
+
if (kind === "fig") {
|
|
9686
|
+
return ["\u0627\u0644\u0634\u0643\u0644", "\u0634\u0643\u0644", "Figure", "figure"];
|
|
9687
|
+
}
|
|
9688
|
+
if (kind === "tab") {
|
|
9689
|
+
return ["\u0627\u0644\u062C\u062F\u0648\u0644", "\u062C\u062F\u0648\u0644", "Table", "table"];
|
|
9690
|
+
}
|
|
9691
|
+
return ["\u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629", "\u0645\u0639\u0627\u062F\u0644\u0629", "Equation", "equation"];
|
|
9692
|
+
}
|
|
9693
|
+
function previousTextAlreadyNamesKind(previousToken, kind) {
|
|
9694
|
+
if (previousToken?.kind !== "text") {
|
|
9695
|
+
return false;
|
|
9696
|
+
}
|
|
9697
|
+
const text = previousToken.text.trimEnd();
|
|
9698
|
+
return semanticRefNames(kind).some((name) => text.endsWith(name));
|
|
9699
|
+
}
|
|
9700
|
+
function refTokenLatexForDocument(token, labelKinds, previousToken) {
|
|
9701
|
+
const reference = refTokenLatex(token.keys, token.refCommand);
|
|
9702
|
+
if (!labelKinds || token.keys.length !== 1) {
|
|
9703
|
+
return reference;
|
|
9704
|
+
}
|
|
9705
|
+
const kind = labelKinds.get(token.keys[0]);
|
|
9706
|
+
if (!kind || previousTextAlreadyNamesKind(previousToken, kind)) {
|
|
9707
|
+
return reference;
|
|
9708
|
+
}
|
|
9709
|
+
return `${semanticRefPrefix(kind)}~${reference}`;
|
|
9710
|
+
}
|
|
9711
|
+
function tokenLatex(token, labelKinds, previousToken) {
|
|
9681
9712
|
if (token.kind === "text") {
|
|
9682
9713
|
return styledTextLatex(token.text, token.style);
|
|
9683
9714
|
}
|
|
@@ -9685,7 +9716,7 @@ function tokenLatex(token) {
|
|
|
9685
9716
|
return citeTokenLatex(token.keys);
|
|
9686
9717
|
}
|
|
9687
9718
|
if (token.kind === "ref") {
|
|
9688
|
-
return
|
|
9719
|
+
return refTokenLatexForDocument(token, labelKinds, previousToken);
|
|
9689
9720
|
}
|
|
9690
9721
|
if (token.display && token.labelEnabled && token.label && token.label.trim().length > 0) {
|
|
9691
9722
|
const body = mathBodyLatex(token);
|
|
@@ -9702,11 +9733,11 @@ ${body}
|
|
|
9702
9733
|
}
|
|
9703
9734
|
return renderMathNodeLatex(token.math);
|
|
9704
9735
|
}
|
|
9705
|
-
function
|
|
9706
|
-
return field.tokens.map((token) => tokenLatex(token)).join("");
|
|
9736
|
+
function inlineFieldLatexWithLabelKinds(field, labelKinds) {
|
|
9737
|
+
return field.tokens.map((token, index) => tokenLatex(token, labelKinds, field.tokens[index - 1])).join("");
|
|
9707
9738
|
}
|
|
9708
|
-
function textBlockLatex(block) {
|
|
9709
|
-
const content =
|
|
9739
|
+
function textBlockLatex(block, labelKinds) {
|
|
9740
|
+
const content = inlineFieldLatexWithLabelKinds(block.field, labelKinds);
|
|
9710
9741
|
const body = block.command === "\\paragraph" ? `\\par
|
|
9711
9742
|
${content}` : `${block.command}{${content}}`;
|
|
9712
9743
|
if (block.command === "\\paragraph" && block.centered) {
|
|
@@ -9719,38 +9750,61 @@ ${body}
|
|
|
9719
9750
|
function indent(value) {
|
|
9720
9751
|
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
9721
9752
|
}
|
|
9722
|
-
function listBlockLatex(block, references) {
|
|
9753
|
+
function listBlockLatex(block, references, labelKinds, fixedFloats) {
|
|
9723
9754
|
const items = block.items.map((item) => {
|
|
9724
|
-
const nested = item.blocks.map((child) => "\n" + indent(blockLatex(child, references))).join("");
|
|
9725
|
-
return ` \\item ${
|
|
9755
|
+
const nested = item.blocks.map((child) => "\n" + indent(blockLatex(child, references, labelKinds, fixedFloats))).join("");
|
|
9756
|
+
return ` \\item ${inlineFieldLatexWithLabelKinds(item.field, labelKinds)}${nested}`;
|
|
9726
9757
|
}).join("\n");
|
|
9727
9758
|
return `${block.command}
|
|
9728
9759
|
${items}
|
|
9729
9760
|
${block.closing}`;
|
|
9730
9761
|
}
|
|
9731
|
-
function
|
|
9732
|
-
const
|
|
9762
|
+
function defaultGridColumnSpec(block) {
|
|
9763
|
+
const compact = block.columns.replace(/\s+/g, "");
|
|
9764
|
+
const columnCount = block.rows[0]?.length ?? 0;
|
|
9765
|
+
if (columnCount === 0 || compact.length !== columnCount || !/^[lcr]+$/.test(compact)) {
|
|
9766
|
+
return null;
|
|
9767
|
+
}
|
|
9768
|
+
return `|${compact.split("").join("|")}|`;
|
|
9769
|
+
}
|
|
9770
|
+
function tabularInnerLatex(block, labelKinds) {
|
|
9771
|
+
const rows = block.rows.map(
|
|
9772
|
+
(row) => ` ${row.map((cell) => inlineFieldLatexWithLabelKinds(cell, labelKinds)).join(" & ")}`
|
|
9773
|
+
);
|
|
9774
|
+
const gridColumns = defaultGridColumnSpec(block);
|
|
9775
|
+
if (gridColumns) {
|
|
9776
|
+
const griddedRows = rows.map((row) => `${row} \\\\ \\hline`).join("\n");
|
|
9777
|
+
return `${block.command}{${gridColumns}}
|
|
9778
|
+
\\hline
|
|
9779
|
+
${griddedRows}
|
|
9780
|
+
${block.closing}`;
|
|
9781
|
+
}
|
|
9733
9782
|
return `${block.command}{${block.columns}}
|
|
9734
|
-
${rows}
|
|
9783
|
+
${rows.join(" \\\\\n")}
|
|
9735
9784
|
${block.closing}`;
|
|
9736
9785
|
}
|
|
9737
|
-
function floatCaptionLabelLines(block) {
|
|
9786
|
+
function floatCaptionLabelLines(block, counter) {
|
|
9738
9787
|
const lines = [];
|
|
9739
|
-
|
|
9788
|
+
const hasCaption = block.captionEnabled && block.caption.trim().length > 0;
|
|
9789
|
+
if (hasCaption) {
|
|
9740
9790
|
lines.push(` \\caption{${block.caption.trim()}}`);
|
|
9741
9791
|
}
|
|
9742
9792
|
if (block.labelEnabled && block.label.trim().length > 0) {
|
|
9793
|
+
if (!hasCaption) {
|
|
9794
|
+
lines.push(` \\refstepcounter{${counter}}`);
|
|
9795
|
+
}
|
|
9743
9796
|
lines.push(` \\label{${block.label.trim()}}`);
|
|
9744
9797
|
}
|
|
9745
9798
|
return lines;
|
|
9746
9799
|
}
|
|
9747
|
-
function tableBlockLatex(block) {
|
|
9748
|
-
const
|
|
9800
|
+
function tableBlockLatex(block, labelKinds, fixedFloats) {
|
|
9801
|
+
const placement = fixedFloats ? "H" : "htbp";
|
|
9802
|
+
const lines = [`\\begin{table}[${placement}]`];
|
|
9749
9803
|
if (block.centered) {
|
|
9750
9804
|
lines.push(" \\centering");
|
|
9751
9805
|
}
|
|
9752
|
-
lines.push(...floatCaptionLabelLines(block));
|
|
9753
|
-
lines.push(indent(tabularInnerLatex(block)));
|
|
9806
|
+
lines.push(...floatCaptionLabelLines(block, "table"));
|
|
9807
|
+
lines.push(indent(tabularInnerLatex(block, labelKinds)));
|
|
9754
9808
|
lines.push("\\end{table}");
|
|
9755
9809
|
return lines.join("\n");
|
|
9756
9810
|
}
|
|
@@ -9769,28 +9823,29 @@ function imageOptionsLatex(block, constrainToColumn) {
|
|
|
9769
9823
|
}
|
|
9770
9824
|
return `[${entries.map(([key, value]) => `${key}=${value}`).join(",")}]`;
|
|
9771
9825
|
}
|
|
9772
|
-
function imageBlockLatex(block) {
|
|
9773
|
-
const
|
|
9826
|
+
function imageBlockLatex(block, fixedFloats) {
|
|
9827
|
+
const placement = fixedFloats ? "H" : "htbp";
|
|
9828
|
+
const lines = [`\\begin{figure}[${placement}]`];
|
|
9774
9829
|
if (block.centered) {
|
|
9775
9830
|
lines.push(" \\centering");
|
|
9776
9831
|
}
|
|
9777
9832
|
lines.push(` ${block.command}${imageOptionsLatex(block, true)}{${block.value}}`);
|
|
9778
|
-
lines.push(...floatCaptionLabelLines(block));
|
|
9833
|
+
lines.push(...floatCaptionLabelLines(block, "figure"));
|
|
9779
9834
|
lines.push("\\end{figure}");
|
|
9780
9835
|
return lines.join("\n");
|
|
9781
9836
|
}
|
|
9782
|
-
function blockLatex(block, references) {
|
|
9837
|
+
function blockLatex(block, references, labelKinds, fixedFloats) {
|
|
9783
9838
|
if (block.kind === "textBlock") {
|
|
9784
|
-
return textBlockLatex(block);
|
|
9839
|
+
return textBlockLatex(block, labelKinds);
|
|
9785
9840
|
}
|
|
9786
9841
|
if (block.kind === "list") {
|
|
9787
|
-
return listBlockLatex(block, references);
|
|
9842
|
+
return listBlockLatex(block, references, labelKinds, fixedFloats);
|
|
9788
9843
|
}
|
|
9789
9844
|
if (block.kind === "table") {
|
|
9790
|
-
return tableBlockLatex(block);
|
|
9845
|
+
return tableBlockLatex(block, labelKinds, fixedFloats);
|
|
9791
9846
|
}
|
|
9792
9847
|
if (block.kind === "image") {
|
|
9793
|
-
return imageBlockLatex(block);
|
|
9848
|
+
return imageBlockLatex(block, fixedFloats);
|
|
9794
9849
|
}
|
|
9795
9850
|
if (block.kind === "bibliography") {
|
|
9796
9851
|
const width = String(Math.max(references.length, 9));
|
|
@@ -9832,12 +9887,29 @@ ${meta.abstract.trim()}
|
|
|
9832
9887
|
}
|
|
9833
9888
|
return parts;
|
|
9834
9889
|
}
|
|
9890
|
+
function documentLabelKindMap(document2) {
|
|
9891
|
+
const map = /* @__PURE__ */ new Map();
|
|
9892
|
+
for (const entry of collectDocument2Labels(document2)) {
|
|
9893
|
+
if (!map.has(entry.key)) {
|
|
9894
|
+
map.set(entry.key, entry.kind);
|
|
9895
|
+
}
|
|
9896
|
+
}
|
|
9897
|
+
return map;
|
|
9898
|
+
}
|
|
9899
|
+
function closingHamdalaLatex() {
|
|
9900
|
+
return `\\begin{center}
|
|
9901
|
+
\\maghribi{${BUTEX_CLOSING_HAMDALA}}
|
|
9902
|
+
\\end{center}`;
|
|
9903
|
+
}
|
|
9835
9904
|
function document2Latex(document2, options = {}) {
|
|
9836
9905
|
const meta = document2.meta ?? emptyDocument2Meta();
|
|
9837
9906
|
const twocolumn = options.twocolumn === true;
|
|
9838
9907
|
const front = articleFrontMatterLatex(meta);
|
|
9839
|
-
const
|
|
9840
|
-
const
|
|
9908
|
+
const labelKinds = documentLabelKindMap(document2);
|
|
9909
|
+
const bodyBlocks = document2.blocks.map(
|
|
9910
|
+
(block) => blockLatex(block, document2.references, labelKinds, twocolumn)
|
|
9911
|
+
);
|
|
9912
|
+
const closing = closingHamdalaLatex();
|
|
9841
9913
|
const body = [...front, ...bodyBlocks, closing].filter((part) => part.length > 0).join("\n\n");
|
|
9842
9914
|
const wrapDocument = options.wrapDocument !== false;
|
|
9843
9915
|
if (!wrapDocument) {
|
|
@@ -9846,10 +9918,11 @@ function document2Latex(document2, options = {}) {
|
|
|
9846
9918
|
|
|
9847
9919
|
${body}` : body;
|
|
9848
9920
|
}
|
|
9921
|
+
const floatPackage = twocolumn ? "\n\\usepackage{float}\n" : "\n";
|
|
9849
9922
|
const preamble = getArabicXeLatexPreamble({
|
|
9850
9923
|
digitsMapping: options.digitsMapping ?? digitsMappingFromDigitForm(options.digitForm),
|
|
9851
9924
|
twocolumn
|
|
9852
|
-
}) +
|
|
9925
|
+
}) + floatPackage + articleMaketitlePreamble(meta, twocolumn);
|
|
9853
9926
|
return `${preamble}
|
|
9854
9927
|
\\begin{document}
|
|
9855
9928
|
|
|
@@ -10447,6 +10520,15 @@ function document2Messages(locale) {
|
|
|
10447
10520
|
return DOCUMENT2_MESSAGES[locale];
|
|
10448
10521
|
}
|
|
10449
10522
|
|
|
10523
|
+
// src/react-document2/xelatexTextValidation.ts
|
|
10524
|
+
var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
10525
|
+
function hasXeLatexUnsupportedEmoji(value) {
|
|
10526
|
+
return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
|
|
10527
|
+
}
|
|
10528
|
+
function unsupportedEmojiMessage(uiLocale) {
|
|
10529
|
+
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.";
|
|
10530
|
+
}
|
|
10531
|
+
|
|
10450
10532
|
// src/react-document2/ArticleMetaPanel.tsx
|
|
10451
10533
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
10452
10534
|
var HIJRI_DAYS = Array.from({ length: 30 }, (_, index) => index + 1);
|
|
@@ -10454,6 +10536,20 @@ var HIJRI_YEARS = Array.from(
|
|
|
10454
10536
|
{ length: HIJRI_YEAR_MAX - HIJRI_YEAR_MIN + 1 },
|
|
10455
10537
|
(_, index) => HIJRI_YEAR_MIN + index
|
|
10456
10538
|
);
|
|
10539
|
+
var UNSUPPORTED_EMOJI_STYLE = {
|
|
10540
|
+
borderColor: "var(--butex-document2-error)",
|
|
10541
|
+
background: "var(--butex-document2-error-bg)"
|
|
10542
|
+
};
|
|
10543
|
+
function UnsupportedEmojiWarning({
|
|
10544
|
+
id,
|
|
10545
|
+
show,
|
|
10546
|
+
uiLocale
|
|
10547
|
+
}) {
|
|
10548
|
+
if (!show) {
|
|
10549
|
+
return null;
|
|
10550
|
+
}
|
|
10551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id, className: "butex-document2-widget__field-error", children: unsupportedEmojiMessage(uiLocale) });
|
|
10552
|
+
}
|
|
10457
10553
|
function HijriDateMenu({
|
|
10458
10554
|
label,
|
|
10459
10555
|
value,
|
|
@@ -10531,6 +10627,12 @@ function ArticleMetaPanel({
|
|
|
10531
10627
|
const localRef = (0, import_react.useRef)(null);
|
|
10532
10628
|
const resolvedRef = panelRef ?? localRef;
|
|
10533
10629
|
const formattedDate = formatHijriDate(meta.date, { locale: uiLocale, digitForm });
|
|
10630
|
+
const titleUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.title);
|
|
10631
|
+
const authorsUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.authors);
|
|
10632
|
+
const abstractUnsupportedEmoji = hasXeLatexUnsupportedEmoji(meta.abstract);
|
|
10633
|
+
const titleErrorId = "butex-document2-meta-title-unsupported-emoji";
|
|
10634
|
+
const authorsErrorId = "butex-document2-meta-authors-unsupported-emoji";
|
|
10635
|
+
const abstractErrorId = "butex-document2-meta-abstract-unsupported-emoji";
|
|
10534
10636
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
10535
10637
|
"section",
|
|
10536
10638
|
{
|
|
@@ -10557,12 +10659,16 @@ function ArticleMetaPanel({
|
|
|
10557
10659
|
{
|
|
10558
10660
|
ref: titleInputRef,
|
|
10559
10661
|
value: meta.title,
|
|
10662
|
+
"aria-invalid": titleUnsupportedEmoji ? true : void 0,
|
|
10663
|
+
"aria-describedby": titleUnsupportedEmoji ? titleErrorId : void 0,
|
|
10664
|
+
style: titleUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
|
|
10560
10665
|
onChange: (event) => {
|
|
10561
10666
|
const value = event.currentTarget.value;
|
|
10562
10667
|
onChange({ title: value });
|
|
10563
10668
|
}
|
|
10564
10669
|
}
|
|
10565
|
-
)
|
|
10670
|
+
),
|
|
10671
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnsupportedEmojiWarning, { id: titleErrorId, show: titleUnsupportedEmoji, uiLocale })
|
|
10566
10672
|
] }),
|
|
10567
10673
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "butex-document2-widget__article-meta-field", children: [
|
|
10568
10674
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: messages.articleAuthors }),
|
|
@@ -10571,12 +10677,16 @@ function ArticleMetaPanel({
|
|
|
10571
10677
|
{
|
|
10572
10678
|
rows: 2,
|
|
10573
10679
|
value: meta.authors,
|
|
10680
|
+
"aria-invalid": authorsUnsupportedEmoji ? true : void 0,
|
|
10681
|
+
"aria-describedby": authorsUnsupportedEmoji ? authorsErrorId : void 0,
|
|
10682
|
+
style: authorsUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
|
|
10574
10683
|
onChange: (event) => {
|
|
10575
10684
|
const value = event.currentTarget.value;
|
|
10576
10685
|
onChange({ authors: value });
|
|
10577
10686
|
}
|
|
10578
10687
|
}
|
|
10579
|
-
)
|
|
10688
|
+
),
|
|
10689
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnsupportedEmojiWarning, { id: authorsErrorId, show: authorsUnsupportedEmoji, uiLocale })
|
|
10580
10690
|
] }),
|
|
10581
10691
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "butex-document2-widget__article-meta-field", children: [
|
|
10582
10692
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: messages.articleDate }),
|
|
@@ -10627,12 +10737,16 @@ function ArticleMetaPanel({
|
|
|
10627
10737
|
{
|
|
10628
10738
|
rows: 3,
|
|
10629
10739
|
value: meta.abstract,
|
|
10740
|
+
"aria-invalid": abstractUnsupportedEmoji ? true : void 0,
|
|
10741
|
+
"aria-describedby": abstractUnsupportedEmoji ? abstractErrorId : void 0,
|
|
10742
|
+
style: abstractUnsupportedEmoji ? UNSUPPORTED_EMOJI_STYLE : void 0,
|
|
10630
10743
|
onChange: (event) => {
|
|
10631
10744
|
const value = event.currentTarget.value;
|
|
10632
10745
|
onChange({ abstract: value });
|
|
10633
10746
|
}
|
|
10634
10747
|
}
|
|
10635
|
-
)
|
|
10748
|
+
),
|
|
10749
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnsupportedEmojiWarning, { id: abstractErrorId, show: abstractUnsupportedEmoji, uiLocale })
|
|
10636
10750
|
] })
|
|
10637
10751
|
] }),
|
|
10638
10752
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "butex-document2-widget__article-meta-fixed", dir: "rtl", children: BUTEX_CLOSING_HAMDALA })
|
|
@@ -11368,12 +11482,6 @@ function RefChip({
|
|
|
11368
11482
|
] });
|
|
11369
11483
|
}
|
|
11370
11484
|
|
|
11371
|
-
// src/react-document2/xelatexTextValidation.ts
|
|
11372
|
-
var XELATEX_UNSUPPORTED_EMOJI_PATTERN = /[\p{Emoji_Presentation}\p{Emoji_Modifier}\p{Regional_Indicator}\uFE0F\u20E3]/u;
|
|
11373
|
-
function hasXeLatexUnsupportedEmoji(value) {
|
|
11374
|
-
return XELATEX_UNSUPPORTED_EMOJI_PATTERN.test(value);
|
|
11375
|
-
}
|
|
11376
|
-
|
|
11377
11485
|
// src/react-document2/InlineField.tsx
|
|
11378
11486
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
11379
11487
|
function rememberCaret(element, blockId, fieldId, tokenId, onFieldFocus) {
|
|
@@ -11393,9 +11501,6 @@ function fitTextareaHeight(element) {
|
|
|
11393
11501
|
element.style.height = "auto";
|
|
11394
11502
|
element.style.height = `${String(element.scrollHeight)}px`;
|
|
11395
11503
|
}
|
|
11396
|
-
function xeLatexUnsupportedEmojiMessage(uiLocale) {
|
|
11397
|
-
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.";
|
|
11398
|
-
}
|
|
11399
11504
|
function InlineField({
|
|
11400
11505
|
field,
|
|
11401
11506
|
blockId,
|
|
@@ -11515,7 +11620,7 @@ function InlineField({
|
|
|
11515
11620
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "butex-document2-widget__inline-field", dir: documentDirection, "data-document-direction": documentDirection, children: field.tokens.map((token) => {
|
|
11516
11621
|
if (token.kind === "text") {
|
|
11517
11622
|
const unsupportedEmoji = hasXeLatexUnsupportedEmoji(token.text);
|
|
11518
|
-
const errorId = `butex-document2-
|
|
11623
|
+
const errorId = `butex-document2-unsupported-emoji-${token.id}`;
|
|
11519
11624
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react3.Fragment, { children: [
|
|
11520
11625
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
11521
11626
|
"textarea",
|
|
@@ -11596,7 +11701,7 @@ function InlineField({
|
|
|
11596
11701
|
id: errorId,
|
|
11597
11702
|
className: "butex-document2-widget__field-error",
|
|
11598
11703
|
style: { flexBasis: "100%" },
|
|
11599
|
-
children:
|
|
11704
|
+
children: unsupportedEmojiMessage(uiLocale)
|
|
11600
11705
|
}
|
|
11601
11706
|
) : null
|
|
11602
11707
|
] }, token.id);
|