@drghaliasri/butex 6.1.1 → 6.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/document2.d.mts +1 -1
- package/dist/document2.d.ts +1 -1
- package/dist/document2.js +1 -1
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +1 -1
- package/dist/document2.mjs.map +1 -1
- package/dist/react-document2.js +114 -67
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +306 -259
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.js +20 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +20 -0
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react-document2.js
CHANGED
|
@@ -33,6 +33,26 @@ __export(react_document2_entry_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(react_document2_entry_exports);
|
|
35
35
|
|
|
36
|
+
// src/react/matrixPickerCss.ts
|
|
37
|
+
var MATRIX_PICKER_CSS = `
|
|
38
|
+
.butex-widget .matrix-grid-picker,
|
|
39
|
+
.butex-widget .matrix-grid-cell {
|
|
40
|
+
box-sizing: border-box;
|
|
41
|
+
}
|
|
42
|
+
`.trim();
|
|
43
|
+
var MATRIX_PICKER_STYLE_ID = "butex-matrix-picker-css";
|
|
44
|
+
function injectMatrixPickerCss(doc) {
|
|
45
|
+
const d = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
46
|
+
if (!d || d.getElementById(MATRIX_PICKER_STYLE_ID)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const style = d.createElement("style");
|
|
50
|
+
style.id = MATRIX_PICKER_STYLE_ID;
|
|
51
|
+
style.textContent = MATRIX_PICKER_CSS;
|
|
52
|
+
d.head.appendChild(style);
|
|
53
|
+
}
|
|
54
|
+
injectMatrixPickerCss();
|
|
55
|
+
|
|
36
56
|
// src/react-document2/ArticleMetaPanel.tsx
|
|
37
57
|
var import_react = require("react");
|
|
38
58
|
|
|
@@ -9360,7 +9380,7 @@ function toDocumentJson2(document2) {
|
|
|
9360
9380
|
}
|
|
9361
9381
|
|
|
9362
9382
|
// src/document2/keys.ts
|
|
9363
|
-
var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}
|
|
9383
|
+
var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}\p{Nd}:._-]+$/u;
|
|
9364
9384
|
function normalizeDocument2Key(key) {
|
|
9365
9385
|
return key.normalize("NFC").trim();
|
|
9366
9386
|
}
|
|
@@ -10220,7 +10240,7 @@ var DOCUMENT2_MESSAGES = {
|
|
|
10220
10240
|
editInternalRef: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0631\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A",
|
|
10221
10241
|
deleteInternalRef: "\u062D\u0630\u0641 \u0627\u0644\u0645\u0631\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A",
|
|
10222
10242
|
labelsTitle: "\u0627\u0644\u062A\u0633\u0645\u064A\u0627\u062A \u0648\u0627\u0644\u0645\u0631\u0627\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A\u0629",
|
|
10223
|
-
labelsHelp: "\u0627\u0644\u062A\u0633\u0645\u064A\u0627\u062A \u0644\u0644\u0645\u0631\u0627\u062C\u0639 \u062F\u0627\u062E\u0644 \u0627\u0644\u0645\u0633\u062A\u0646\u062F\u061B \
|
|
10243
|
+
labelsHelp: "\u0627\u0644\u062A\u0633\u0645\u064A\u0627\u062A \u0644\u0644\u0645\u0631\u0627\u062C\u0639 \u062F\u0627\u062E\u0644 \u0627\u0644\u0645\u0633\u062A\u0646\u062F\u061B \u0648\u0627\u0644\u0627\u0642\u062A\u0628\u0627\u0633\u0627\u062A \u062A\u0633\u062A\u0646\u062F \u0625\u0644\u0649 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0645\u0631\u0627\u062C\u0639.",
|
|
10224
10244
|
captionToggle: "\u062A\u0639\u0644\u064A\u0642",
|
|
10225
10245
|
labelToggle: "\u062A\u0633\u0645\u064A\u0629",
|
|
10226
10246
|
centerParagraph: "\u062A\u0648\u0633\u064A\u0637 \u0627\u0644\u0641\u0642\u0631\u0629",
|
|
@@ -11348,6 +11368,12 @@ function RefChip({
|
|
|
11348
11368
|
] });
|
|
11349
11369
|
}
|
|
11350
11370
|
|
|
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
|
+
|
|
11351
11377
|
// src/react-document2/InlineField.tsx
|
|
11352
11378
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
11353
11379
|
function rememberCaret(element, blockId, fieldId, tokenId, onFieldFocus) {
|
|
@@ -11367,6 +11393,9 @@ function fitTextareaHeight(element) {
|
|
|
11367
11393
|
element.style.height = "auto";
|
|
11368
11394
|
element.style.height = `${String(element.scrollHeight)}px`;
|
|
11369
11395
|
}
|
|
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
|
+
}
|
|
11370
11399
|
function InlineField({
|
|
11371
11400
|
field,
|
|
11372
11401
|
blockId,
|
|
@@ -11485,74 +11514,92 @@ function InlineField({
|
|
|
11485
11514
|
const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
11486
11515
|
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) => {
|
|
11487
11516
|
if (token.kind === "text") {
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
if (!collapsed) {
|
|
11517
|
-
return;
|
|
11518
|
-
}
|
|
11519
|
-
if (event.key === forwardArrowKey && element.selectionStart === element.value.length) {
|
|
11520
|
-
const next = adjacentIslandId(token.id, 1);
|
|
11521
|
-
if (next) {
|
|
11522
|
-
event.preventDefault();
|
|
11523
|
-
if (next.kind === "math") {
|
|
11524
|
-
focusMathToken(next.id);
|
|
11525
|
-
} else if (next.kind === "cite") {
|
|
11526
|
-
focusCiteToken(next.id);
|
|
11527
|
-
} else {
|
|
11528
|
-
focusRefToken(next.id);
|
|
11529
|
-
}
|
|
11517
|
+
const unsupportedEmoji = hasXeLatexUnsupportedEmoji(token.text);
|
|
11518
|
+
const errorId = `butex-document2-xelatex-text-error-${token.id}`;
|
|
11519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react3.Fragment, { children: [
|
|
11520
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
11521
|
+
"textarea",
|
|
11522
|
+
{
|
|
11523
|
+
className: "butex-document2-widget__inline-text",
|
|
11524
|
+
value: token.text,
|
|
11525
|
+
"data-bold": token.style?.bold === true ? "true" : void 0,
|
|
11526
|
+
"data-italic": token.style?.italic === true ? "true" : void 0,
|
|
11527
|
+
"data-underline": token.style?.underline === true ? "true" : void 0,
|
|
11528
|
+
dir: documentDirection,
|
|
11529
|
+
"aria-label": messages.text,
|
|
11530
|
+
"aria-invalid": unsupportedEmoji ? true : void 0,
|
|
11531
|
+
"aria-describedby": unsupportedEmoji ? errorId : void 0,
|
|
11532
|
+
rows: 1,
|
|
11533
|
+
"data-field-id": field.id,
|
|
11534
|
+
"data-text-token-id": token.id,
|
|
11535
|
+
style: unsupportedEmoji ? {
|
|
11536
|
+
borderColor: "var(--butex-document2-error)",
|
|
11537
|
+
background: "var(--butex-document2-error-bg)"
|
|
11538
|
+
} : void 0,
|
|
11539
|
+
ref: (element) => {
|
|
11540
|
+
if (element) {
|
|
11541
|
+
textRefs.current.set(token.id, element);
|
|
11542
|
+
fitTextareaHeight(element);
|
|
11543
|
+
} else {
|
|
11544
|
+
textRefs.current.delete(token.id);
|
|
11530
11545
|
}
|
|
11531
|
-
}
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11546
|
+
},
|
|
11547
|
+
onChange: (event) => {
|
|
11548
|
+
onTextChange(field.id, token.id, event.currentTarget.value);
|
|
11549
|
+
fitTextareaHeight(event.currentTarget);
|
|
11550
|
+
},
|
|
11551
|
+
onKeyDown: (event) => {
|
|
11552
|
+
const element = event.currentTarget;
|
|
11553
|
+
const collapsed = element.selectionStart === element.selectionEnd;
|
|
11554
|
+
if (!collapsed) {
|
|
11555
|
+
return;
|
|
11556
|
+
}
|
|
11557
|
+
if (event.key === forwardArrowKey && element.selectionStart === element.value.length) {
|
|
11558
|
+
const next = adjacentIslandId(token.id, 1);
|
|
11559
|
+
if (next) {
|
|
11560
|
+
event.preventDefault();
|
|
11561
|
+
if (next.kind === "math") {
|
|
11562
|
+
focusMathToken(next.id);
|
|
11563
|
+
} else if (next.kind === "cite") {
|
|
11564
|
+
focusCiteToken(next.id);
|
|
11565
|
+
} else {
|
|
11566
|
+
focusRefToken(next.id);
|
|
11567
|
+
}
|
|
11568
|
+
}
|
|
11569
|
+
} else if (event.key === backwardArrowKey && element.selectionStart === 0) {
|
|
11570
|
+
const previous = adjacentIslandId(token.id, -1);
|
|
11571
|
+
if (previous) {
|
|
11572
|
+
event.preventDefault();
|
|
11573
|
+
if (previous.kind === "math") {
|
|
11574
|
+
focusMathToken(previous.id);
|
|
11575
|
+
} else if (previous.kind === "cite") {
|
|
11576
|
+
focusCiteToken(previous.id);
|
|
11577
|
+
} else {
|
|
11578
|
+
focusRefToken(previous.id);
|
|
11579
|
+
}
|
|
11541
11580
|
}
|
|
11542
11581
|
}
|
|
11543
|
-
}
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11582
|
+
},
|
|
11583
|
+
onFocus: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
|
|
11584
|
+
onClick: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
|
|
11585
|
+
onKeyUp: (event) => {
|
|
11586
|
+
rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus);
|
|
11587
|
+
fitTextareaHeight(event.currentTarget);
|
|
11588
|
+
},
|
|
11589
|
+
onSelect: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
|
|
11590
|
+
onBlur: () => onFieldBlur?.()
|
|
11591
|
+
}
|
|
11592
|
+
),
|
|
11593
|
+
unsupportedEmoji ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
11594
|
+
"p",
|
|
11595
|
+
{
|
|
11596
|
+
id: errorId,
|
|
11597
|
+
className: "butex-document2-widget__field-error",
|
|
11598
|
+
style: { flexBasis: "100%" },
|
|
11599
|
+
children: xeLatexUnsupportedEmojiMessage(uiLocale)
|
|
11600
|
+
}
|
|
11601
|
+
) : null
|
|
11602
|
+
] }, token.id);
|
|
11556
11603
|
}
|
|
11557
11604
|
if (token.kind === "cite") {
|
|
11558
11605
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|