@drghaliasri/butex 6.0.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/README.md +8 -2
- package/dist/document2-cli.js +984 -280
- package/dist/document2-cli.js.map +1 -1
- package/dist/document2.d.mts +157 -9
- package/dist/document2.d.ts +157 -9
- package/dist/document2.js +1055 -241
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +1055 -241
- package/dist/document2.mjs.map +1 -1
- package/dist/react-document2.d.mts +31 -0
- package/dist/react-document2.d.ts +31 -0
- package/dist/react-document2.js +315 -153
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +496 -334
- 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.mjs
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
// src/react/matrixPickerCss.ts
|
|
2
|
+
var MATRIX_PICKER_CSS = `
|
|
3
|
+
.butex-widget .matrix-grid-picker,
|
|
4
|
+
.butex-widget .matrix-grid-cell {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
`.trim();
|
|
8
|
+
var MATRIX_PICKER_STYLE_ID = "butex-matrix-picker-css";
|
|
9
|
+
function injectMatrixPickerCss(doc) {
|
|
10
|
+
const d = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
11
|
+
if (!d || d.getElementById(MATRIX_PICKER_STYLE_ID)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const style = d.createElement("style");
|
|
15
|
+
style.id = MATRIX_PICKER_STYLE_ID;
|
|
16
|
+
style.textContent = MATRIX_PICKER_CSS;
|
|
17
|
+
d.head.appendChild(style);
|
|
18
|
+
}
|
|
19
|
+
injectMatrixPickerCss();
|
|
20
|
+
|
|
1
21
|
// src/react-document2/ArticleMetaPanel.tsx
|
|
2
22
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
23
|
|
|
@@ -970,6 +990,76 @@ function applyFloatMetaPatch(block, patch) {
|
|
|
970
990
|
}
|
|
971
991
|
}
|
|
972
992
|
|
|
993
|
+
// src/document2/inlineIdentity.ts
|
|
994
|
+
function createDocument2IdentityState() {
|
|
995
|
+
return {
|
|
996
|
+
blockIds: /* @__PURE__ */ new Set(),
|
|
997
|
+
itemIds: /* @__PURE__ */ new Set(),
|
|
998
|
+
fieldIds: /* @__PURE__ */ new Set(),
|
|
999
|
+
tokenIds: /* @__PURE__ */ new Set()
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
function importedOrGeneratedId(value, prefix, used) {
|
|
1003
|
+
const imported = typeof value === "string" ? value.trim() : "";
|
|
1004
|
+
if (imported.length > 0 && !used.has(imported)) {
|
|
1005
|
+
used.add(imported);
|
|
1006
|
+
return imported;
|
|
1007
|
+
}
|
|
1008
|
+
let generated = document2Id(prefix);
|
|
1009
|
+
while (used.has(generated)) {
|
|
1010
|
+
generated = document2Id(prefix);
|
|
1011
|
+
}
|
|
1012
|
+
used.add(generated);
|
|
1013
|
+
return generated;
|
|
1014
|
+
}
|
|
1015
|
+
function inlineTokenSource(token) {
|
|
1016
|
+
if (token.kind === "text") {
|
|
1017
|
+
return token.text;
|
|
1018
|
+
}
|
|
1019
|
+
if (token.kind === "math") {
|
|
1020
|
+
return token.source;
|
|
1021
|
+
}
|
|
1022
|
+
if (token.kind === "cite") {
|
|
1023
|
+
return citeTokenLatex(token.keys);
|
|
1024
|
+
}
|
|
1025
|
+
return refTokenLatex(token.keys, token.refCommand);
|
|
1026
|
+
}
|
|
1027
|
+
function inlineIdsFromField(field) {
|
|
1028
|
+
let offset = 0;
|
|
1029
|
+
const tokens = field.tokens.map((token) => {
|
|
1030
|
+
const start = offset;
|
|
1031
|
+
offset += inlineTokenSource(token).length;
|
|
1032
|
+
return { id: token.id, kind: token.kind, start, end: offset };
|
|
1033
|
+
});
|
|
1034
|
+
return { field_id: field.id, tokens };
|
|
1035
|
+
}
|
|
1036
|
+
function isAlignedSidecar(value, field) {
|
|
1037
|
+
if (typeof value !== "object" || value === null || !Array.isArray(value.tokens)) {
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
const tokens = value.tokens;
|
|
1041
|
+
const expected = inlineIdsFromField(field).tokens;
|
|
1042
|
+
if (tokens.length !== expected.length) {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
return tokens.every((token, index) => {
|
|
1046
|
+
const expectedToken = expected[index];
|
|
1047
|
+
return typeof token === "object" && token !== null && expectedToken !== void 0 && token.kind === expectedToken.kind && token.start === expectedToken.start && token.end === expectedToken.end;
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
function applyImportedInlineIds(field, sidecar, state) {
|
|
1051
|
+
field.id = importedOrGeneratedId(
|
|
1052
|
+
typeof sidecar === "object" && sidecar !== null ? sidecar.field_id : void 0,
|
|
1053
|
+
"field",
|
|
1054
|
+
state.fieldIds
|
|
1055
|
+
);
|
|
1056
|
+
const aligned = isAlignedSidecar(sidecar, field);
|
|
1057
|
+
field.tokens.forEach((token, index) => {
|
|
1058
|
+
token.id = importedOrGeneratedId(aligned ? sidecar.tokens[index]?.id : void 0, token.kind, state.tokenIds);
|
|
1059
|
+
});
|
|
1060
|
+
return field;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
973
1063
|
// src/document2/inlineScanner.ts
|
|
974
1064
|
var MATH_ENVIRONMENTS = /* @__PURE__ */ new Set([
|
|
975
1065
|
"equation",
|
|
@@ -1048,17 +1138,13 @@ function citeSpan(value, start) {
|
|
|
1048
1138
|
function refSpan(value, start) {
|
|
1049
1139
|
const eqrefPrefix = "\\eqref{";
|
|
1050
1140
|
const refPrefix = "\\ref{";
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
if (
|
|
1054
|
-
refCommand = "eqref";
|
|
1055
|
-
prefix = eqrefPrefix;
|
|
1056
|
-
} else if (value.startsWith(refPrefix, start) && !isEscaped(value, start)) {
|
|
1057
|
-
refCommand = "ref";
|
|
1058
|
-
prefix = refPrefix;
|
|
1059
|
-
} else {
|
|
1141
|
+
const isEqref = value.startsWith(eqrefPrefix, start) && !isEscaped(value, start);
|
|
1142
|
+
const isRef = value.startsWith(refPrefix, start) && !isEscaped(value, start);
|
|
1143
|
+
if (!isEqref && !isRef) {
|
|
1060
1144
|
return null;
|
|
1061
1145
|
}
|
|
1146
|
+
const refCommand = isEqref ? "eqref" : "ref";
|
|
1147
|
+
const prefix = isEqref ? eqrefPrefix : refPrefix;
|
|
1062
1148
|
const openBrace = start + prefix.length - 1;
|
|
1063
1149
|
if (value[openBrace] !== "{") {
|
|
1064
1150
|
return null;
|
|
@@ -1117,7 +1203,14 @@ function mathSpanAt(value, i) {
|
|
|
1117
1203
|
return null;
|
|
1118
1204
|
}
|
|
1119
1205
|
function detectMathSpans2(value) {
|
|
1120
|
-
return detectInlineSpans2(value).filter((span) => span.kind === "math").map((
|
|
1206
|
+
return detectInlineSpans2(value).filter((span) => span.kind === "math").map((span) => ({
|
|
1207
|
+
start: span.start,
|
|
1208
|
+
end: span.end,
|
|
1209
|
+
source: span.source,
|
|
1210
|
+
opening: span.opening,
|
|
1211
|
+
closing: span.closing,
|
|
1212
|
+
display: span.display
|
|
1213
|
+
}));
|
|
1121
1214
|
}
|
|
1122
1215
|
function detectInlineSpans2(value) {
|
|
1123
1216
|
const spans = [];
|
|
@@ -1171,17 +1264,13 @@ function asBlockJson(value) {
|
|
|
1171
1264
|
return value;
|
|
1172
1265
|
}
|
|
1173
1266
|
function blockIdFromJson(json, state) {
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
let generated = document2Id("block");
|
|
1180
|
-
while (state.used.has(generated)) {
|
|
1181
|
-
generated = document2Id("block");
|
|
1267
|
+
return importedOrGeneratedId(json.id, "block", state.blockIds);
|
|
1268
|
+
}
|
|
1269
|
+
function metadataFromJson(value) {
|
|
1270
|
+
if (!isObject2(value) || value.source !== "agent" && value.source !== "user") {
|
|
1271
|
+
return {};
|
|
1182
1272
|
}
|
|
1183
|
-
|
|
1184
|
-
return generated;
|
|
1273
|
+
return { metadata: { source: value.source } };
|
|
1185
1274
|
}
|
|
1186
1275
|
function pushDiagnostic(diagnostics, options, path, message) {
|
|
1187
1276
|
if (options.strict) {
|
|
@@ -1364,44 +1453,54 @@ function pushFormattedTextTokens(tokens, text, sourceStart, formats) {
|
|
|
1364
1453
|
function closingForList(command) {
|
|
1365
1454
|
return command === "\\begin{itemize}" ? "\\end{itemize}" : "\\end{enumerate}";
|
|
1366
1455
|
}
|
|
1367
|
-
function parseTextBlock(json, options, path, diagnostics,
|
|
1456
|
+
function parseTextBlock(json, options, path, diagnostics, identities) {
|
|
1368
1457
|
const value = requireString(json.value, `${json.command} requires string value`);
|
|
1369
1458
|
return {
|
|
1370
|
-
id: blockIdFromJson(json,
|
|
1459
|
+
id: blockIdFromJson(json, identities),
|
|
1371
1460
|
kind: "textBlock",
|
|
1372
1461
|
command: json.command,
|
|
1373
|
-
field:
|
|
1462
|
+
field: applyImportedInlineIds(
|
|
1463
|
+
createInlineField2(value, json.math_objects ?? [], options, `${path}.value`, diagnostics, json.command === "\\paragraph" ? json.formats ?? [] : []),
|
|
1464
|
+
json.inline_ids,
|
|
1465
|
+
identities
|
|
1466
|
+
),
|
|
1467
|
+
...metadataFromJson(json.metadata),
|
|
1374
1468
|
...json.centered === true ? { centered: true } : {}
|
|
1375
1469
|
};
|
|
1376
1470
|
}
|
|
1377
|
-
function parseListItem(json, options, path, diagnostics,
|
|
1471
|
+
function parseListItem(json, options, path, diagnostics, identities) {
|
|
1378
1472
|
const value = requireString(json.value, "Document list item requires string value");
|
|
1379
1473
|
const blocksJson = Array.isArray(json.blocks) ? json.blocks : [];
|
|
1380
1474
|
return {
|
|
1381
|
-
id:
|
|
1382
|
-
field:
|
|
1475
|
+
id: importedOrGeneratedId(json.id, "item", identities.itemIds),
|
|
1476
|
+
field: applyImportedInlineIds(
|
|
1477
|
+
createInlineField2(value, json.math_objects ?? [], options, `${path}.value`, diagnostics, json.formats ?? []),
|
|
1478
|
+
json.inline_ids,
|
|
1479
|
+
identities
|
|
1480
|
+
),
|
|
1383
1481
|
blocks: blocksJson.map(
|
|
1384
|
-
(block, index) => parseBlock(asBlockJson(block), options, `${path}.blocks[${String(index)}]`, diagnostics,
|
|
1482
|
+
(block, index) => parseBlock(asBlockJson(block), options, `${path}.blocks[${String(index)}]`, diagnostics, identities)
|
|
1385
1483
|
)
|
|
1386
1484
|
};
|
|
1387
1485
|
}
|
|
1388
|
-
function parseListBlock(json, options, path, diagnostics,
|
|
1486
|
+
function parseListBlock(json, options, path, diagnostics, identities) {
|
|
1389
1487
|
if (!Array.isArray(json.items)) {
|
|
1390
1488
|
throw new Error(`${json.command} requires items array`);
|
|
1391
1489
|
}
|
|
1392
1490
|
const command = json.command;
|
|
1393
1491
|
const closing = closingForList(command);
|
|
1394
1492
|
return {
|
|
1395
|
-
id: blockIdFromJson(json,
|
|
1493
|
+
id: blockIdFromJson(json, identities),
|
|
1396
1494
|
kind: "list",
|
|
1397
1495
|
command,
|
|
1398
1496
|
closing,
|
|
1399
1497
|
items: json.items.map(
|
|
1400
|
-
(item, index) => parseListItem(item, options, `${path}.items[${String(index)}]`, diagnostics,
|
|
1401
|
-
)
|
|
1498
|
+
(item, index) => parseListItem(item, options, `${path}.items[${String(index)}]`, diagnostics, identities)
|
|
1499
|
+
),
|
|
1500
|
+
...metadataFromJson(json.metadata)
|
|
1402
1501
|
};
|
|
1403
1502
|
}
|
|
1404
|
-
function parseTableBlock(json, options, path, diagnostics,
|
|
1503
|
+
function parseTableBlock(json, options, path, diagnostics, identities) {
|
|
1405
1504
|
if (!Array.isArray(json.rows)) {
|
|
1406
1505
|
throw new Error("\\begin{tabular} requires rows array");
|
|
1407
1506
|
}
|
|
@@ -1417,75 +1516,84 @@ function parseTableBlock(json, options, path, diagnostics, blockIds) {
|
|
|
1417
1516
|
const cellMathObjects = mathObjects.slice(mathObjectIndex, mathObjectIndex + spanCount);
|
|
1418
1517
|
mathObjectIndex += spanCount;
|
|
1419
1518
|
const cellFormats = json.cell_formats?.[rowIndex]?.[columnIndex] ?? [];
|
|
1420
|
-
return
|
|
1519
|
+
return applyImportedInlineIds(
|
|
1520
|
+
createInlineField2(value, cellMathObjects, options, `${path}.rows[${String(rowIndex)}][${String(columnIndex)}]`, diagnostics, cellFormats),
|
|
1521
|
+
json.cell_inline_ids?.[rowIndex]?.[columnIndex],
|
|
1522
|
+
identities
|
|
1523
|
+
);
|
|
1421
1524
|
});
|
|
1422
1525
|
});
|
|
1423
1526
|
if (mathObjects.length > 0 && mathObjects.length !== mathObjectIndex) {
|
|
1424
1527
|
pushDiagnostic(diagnostics, options, path, `math_objects count mismatch: detected ${String(mathObjectIndex)}, got ${String(mathObjects.length)}`);
|
|
1425
1528
|
}
|
|
1426
1529
|
return {
|
|
1427
|
-
id: blockIdFromJson(json,
|
|
1530
|
+
id: blockIdFromJson(json, identities),
|
|
1428
1531
|
kind: "table",
|
|
1429
1532
|
command: "\\begin{tabular}",
|
|
1430
1533
|
closing: "\\end{tabular}",
|
|
1431
1534
|
columns: typeof json.columns === "string" ? json.columns : "",
|
|
1432
1535
|
rows,
|
|
1433
|
-
...parseFloatMetaFromJson(json)
|
|
1536
|
+
...parseFloatMetaFromJson(json),
|
|
1537
|
+
...metadataFromJson(json.metadata)
|
|
1434
1538
|
};
|
|
1435
1539
|
}
|
|
1436
|
-
function parseImageBlock(json,
|
|
1540
|
+
function parseImageBlock(json, identities) {
|
|
1437
1541
|
const assetId = typeof json.asset_id === "string" && json.asset_id.length > 0 ? json.asset_id : void 0;
|
|
1438
1542
|
const value = assetId !== void 0 ? typeof json.value === "string" ? json.value : "" : requireString(json.value, "\\includegraphics requires string value");
|
|
1439
1543
|
return {
|
|
1440
|
-
id: blockIdFromJson(json,
|
|
1544
|
+
id: blockIdFromJson(json, identities),
|
|
1441
1545
|
kind: "image",
|
|
1442
1546
|
command: "\\includegraphics",
|
|
1443
1547
|
value,
|
|
1444
1548
|
...assetId !== void 0 ? { assetId } : {},
|
|
1445
1549
|
options: isRecordOfStrings(json.options) ? json.options : {},
|
|
1446
|
-
...parseFloatMetaFromJson(json)
|
|
1550
|
+
...parseFloatMetaFromJson(json),
|
|
1551
|
+
...metadataFromJson(json.metadata)
|
|
1447
1552
|
};
|
|
1448
1553
|
}
|
|
1449
|
-
function parseRawBlock(json,
|
|
1554
|
+
function parseRawBlock(json, identities) {
|
|
1450
1555
|
return {
|
|
1451
|
-
id: blockIdFromJson(json,
|
|
1556
|
+
id: blockIdFromJson(json, identities),
|
|
1452
1557
|
kind: "raw",
|
|
1453
1558
|
command: "\\raw",
|
|
1454
|
-
value: typeof json.value === "string" ? json.value : ""
|
|
1559
|
+
value: typeof json.value === "string" ? json.value : "",
|
|
1560
|
+
...metadataFromJson(json.metadata)
|
|
1455
1561
|
};
|
|
1456
1562
|
}
|
|
1457
|
-
function parseBibliographyBlock(json,
|
|
1563
|
+
function parseBibliographyBlock(json, identities) {
|
|
1458
1564
|
return {
|
|
1459
|
-
id: blockIdFromJson(json,
|
|
1565
|
+
id: blockIdFromJson(json, identities),
|
|
1460
1566
|
kind: "bibliography",
|
|
1461
1567
|
command: "\\begin{thebibliography}",
|
|
1462
|
-
closing: "\\end{thebibliography}"
|
|
1568
|
+
closing: "\\end{thebibliography}",
|
|
1569
|
+
...metadataFromJson(json.metadata)
|
|
1463
1570
|
};
|
|
1464
1571
|
}
|
|
1465
|
-
function parseBlock(json, options, path, diagnostics,
|
|
1572
|
+
function parseBlock(json, options, path, diagnostics, identities) {
|
|
1466
1573
|
if (TEXT_COMMANDS.has(json.command)) {
|
|
1467
|
-
return parseTextBlock(json, options, path, diagnostics,
|
|
1574
|
+
return parseTextBlock(json, options, path, diagnostics, identities);
|
|
1468
1575
|
}
|
|
1469
1576
|
if (LIST_COMMANDS.has(json.command)) {
|
|
1470
|
-
return parseListBlock(json, options, path, diagnostics,
|
|
1577
|
+
return parseListBlock(json, options, path, diagnostics, identities);
|
|
1471
1578
|
}
|
|
1472
1579
|
if (json.command === "\\begin{tabular}") {
|
|
1473
|
-
return parseTableBlock(json, options, path, diagnostics,
|
|
1580
|
+
return parseTableBlock(json, options, path, diagnostics, identities);
|
|
1474
1581
|
}
|
|
1475
1582
|
if (json.command === "\\includegraphics") {
|
|
1476
|
-
return parseImageBlock(json,
|
|
1583
|
+
return parseImageBlock(json, identities);
|
|
1477
1584
|
}
|
|
1478
1585
|
if (json.command === "\\begin{thebibliography}" || json.command === "\\bibliography") {
|
|
1479
|
-
return parseBibliographyBlock(json,
|
|
1586
|
+
return parseBibliographyBlock(json, identities);
|
|
1480
1587
|
}
|
|
1481
1588
|
if (json.command === "\\raw") {
|
|
1482
|
-
return parseRawBlock(json,
|
|
1589
|
+
return parseRawBlock(json, identities);
|
|
1483
1590
|
}
|
|
1484
1591
|
return {
|
|
1485
|
-
id: blockIdFromJson(json,
|
|
1592
|
+
id: blockIdFromJson(json, identities),
|
|
1486
1593
|
kind: "raw",
|
|
1487
1594
|
command: "\\raw",
|
|
1488
|
-
value: typeof json.value === "string" ? json.value : json.command
|
|
1595
|
+
value: typeof json.value === "string" ? json.value : json.command,
|
|
1596
|
+
...metadataFromJson(json.metadata)
|
|
1489
1597
|
};
|
|
1490
1598
|
}
|
|
1491
1599
|
function fromDocumentJson2(json, options = {}) {
|
|
@@ -1496,13 +1604,13 @@ function fromDocumentJson2(json, options = {}) {
|
|
|
1496
1604
|
throw new Error("DocumentObject requires blocks array");
|
|
1497
1605
|
}
|
|
1498
1606
|
const diagnostics = [];
|
|
1499
|
-
const
|
|
1607
|
+
const identities = createDocument2IdentityState();
|
|
1500
1608
|
return {
|
|
1501
1609
|
nodeType: "DocumentObject",
|
|
1502
1610
|
meta: normalizeDocument2Meta(json.meta),
|
|
1503
1611
|
references: parseReferences(json.references),
|
|
1504
1612
|
blocks: json.blocks.map(
|
|
1505
|
-
(block, index) => parseBlock(asBlockJson(block), options, `$.blocks[${String(index)}]`, diagnostics,
|
|
1613
|
+
(block, index) => parseBlock(asBlockJson(block), options, `$.blocks[${String(index)}]`, diagnostics, identities)
|
|
1506
1614
|
),
|
|
1507
1615
|
diagnostics
|
|
1508
1616
|
};
|
|
@@ -8323,12 +8431,14 @@ function cloneField(field) {
|
|
|
8323
8431
|
return { id: field.id, tokens: field.tokens.map(cloneToken) };
|
|
8324
8432
|
}
|
|
8325
8433
|
function cloneBlock(block) {
|
|
8434
|
+
const metadata = block.metadata ? { metadata: { ...block.metadata } } : {};
|
|
8326
8435
|
if (block.kind === "textBlock") {
|
|
8327
|
-
return { ...block, field: cloneField(block.field) };
|
|
8436
|
+
return { ...block, ...metadata, field: cloneField(block.field) };
|
|
8328
8437
|
}
|
|
8329
8438
|
if (block.kind === "list") {
|
|
8330
8439
|
return {
|
|
8331
8440
|
...block,
|
|
8441
|
+
...metadata,
|
|
8332
8442
|
items: block.items.map((item) => ({
|
|
8333
8443
|
...item,
|
|
8334
8444
|
field: cloneField(item.field),
|
|
@@ -8337,12 +8447,12 @@ function cloneBlock(block) {
|
|
|
8337
8447
|
};
|
|
8338
8448
|
}
|
|
8339
8449
|
if (block.kind === "table") {
|
|
8340
|
-
return { ...block, rows: block.rows.map((row) => row.map(cloneField)) };
|
|
8450
|
+
return { ...block, ...metadata, rows: block.rows.map((row) => row.map(cloneField)) };
|
|
8341
8451
|
}
|
|
8342
8452
|
if (block.kind === "image") {
|
|
8343
|
-
return { ...block, options: { ...block.options } };
|
|
8453
|
+
return { ...block, ...metadata, options: { ...block.options } };
|
|
8344
8454
|
}
|
|
8345
|
-
return { ...block };
|
|
8455
|
+
return { ...block, ...metadata };
|
|
8346
8456
|
}
|
|
8347
8457
|
function cloneDocument(document2) {
|
|
8348
8458
|
return {
|
|
@@ -9115,12 +9225,13 @@ function serializeField(field) {
|
|
|
9115
9225
|
...token.label !== void 0 ? { label: token.label } : {}
|
|
9116
9226
|
});
|
|
9117
9227
|
}
|
|
9118
|
-
return { value, formats, mathObjects, hasPersistedMath };
|
|
9228
|
+
return { value, formats, mathObjects, hasPersistedMath, inlineIds: inlineIdsFromField(field) };
|
|
9119
9229
|
}
|
|
9120
9230
|
function fieldJson(field) {
|
|
9121
9231
|
const serialized = serializeField(field);
|
|
9122
9232
|
return {
|
|
9123
9233
|
value: serialized.value,
|
|
9234
|
+
inline_ids: serialized.inlineIds,
|
|
9124
9235
|
...serialized.formats.length > 0 ? { formats: serialized.formats } : {},
|
|
9125
9236
|
...serialized.hasPersistedMath ? { math_objects: serialized.mathObjects } : {}
|
|
9126
9237
|
};
|
|
@@ -9128,7 +9239,9 @@ function fieldJson(field) {
|
|
|
9128
9239
|
function listItemJson(item) {
|
|
9129
9240
|
const field = fieldJson(item.field);
|
|
9130
9241
|
return {
|
|
9242
|
+
id: item.id,
|
|
9131
9243
|
value: field.value ?? "",
|
|
9244
|
+
inline_ids: field.inline_ids,
|
|
9132
9245
|
...field.formats ? { formats: field.formats } : {},
|
|
9133
9246
|
...field.math_objects ? { math_objects: field.math_objects } : {},
|
|
9134
9247
|
...item.blocks.length > 0 ? { blocks: item.blocks.map(blockJson) } : {}
|
|
@@ -9140,6 +9253,7 @@ function blockJson(block) {
|
|
|
9140
9253
|
id: block.id,
|
|
9141
9254
|
command: block.command,
|
|
9142
9255
|
...fieldJson(block.field),
|
|
9256
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {},
|
|
9143
9257
|
...block.command === "\\paragraph" ? { centered: block.centered === true } : {}
|
|
9144
9258
|
};
|
|
9145
9259
|
}
|
|
@@ -9148,7 +9262,8 @@ function blockJson(block) {
|
|
|
9148
9262
|
id: block.id,
|
|
9149
9263
|
command: block.command,
|
|
9150
9264
|
closing: block.closing,
|
|
9151
|
-
items: block.items.map(listItemJson)
|
|
9265
|
+
items: block.items.map(listItemJson),
|
|
9266
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9152
9267
|
};
|
|
9153
9268
|
}
|
|
9154
9269
|
if (block.kind === "table") {
|
|
@@ -9160,13 +9275,15 @@ function blockJson(block) {
|
|
|
9160
9275
|
closing: block.closing,
|
|
9161
9276
|
columns: block.columns,
|
|
9162
9277
|
rows: fields.map((row) => row.map((field) => field.value)),
|
|
9278
|
+
cell_inline_ids: fields.map((row) => row.map((field) => field.inlineIds)),
|
|
9163
9279
|
...fields.some((row) => row.some((field) => field.formats.length > 0)) ? { cell_formats: fields.map((row) => row.map((field) => field.formats)) } : {},
|
|
9164
9280
|
...hasPersistedMath ? { math_objects: fields.flatMap((row) => row.flatMap((field) => field.mathObjects)) } : {},
|
|
9165
9281
|
centered: block.centered,
|
|
9166
9282
|
caption_enabled: block.captionEnabled,
|
|
9167
9283
|
caption: block.caption,
|
|
9168
9284
|
label_enabled: block.labelEnabled,
|
|
9169
|
-
label: block.label
|
|
9285
|
+
label: block.label,
|
|
9286
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9170
9287
|
};
|
|
9171
9288
|
}
|
|
9172
9289
|
if (block.kind === "image") {
|
|
@@ -9180,13 +9297,24 @@ function blockJson(block) {
|
|
|
9180
9297
|
caption_enabled: block.captionEnabled,
|
|
9181
9298
|
caption: block.caption,
|
|
9182
9299
|
label_enabled: block.labelEnabled,
|
|
9183
|
-
label: block.label
|
|
9300
|
+
label: block.label,
|
|
9301
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9184
9302
|
};
|
|
9185
9303
|
}
|
|
9186
9304
|
if (block.kind === "bibliography") {
|
|
9187
|
-
return {
|
|
9305
|
+
return {
|
|
9306
|
+
id: block.id,
|
|
9307
|
+
command: block.command,
|
|
9308
|
+
closing: block.closing,
|
|
9309
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9310
|
+
};
|
|
9188
9311
|
}
|
|
9189
|
-
return {
|
|
9312
|
+
return {
|
|
9313
|
+
id: block.id,
|
|
9314
|
+
command: block.command,
|
|
9315
|
+
value: block.value,
|
|
9316
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9317
|
+
};
|
|
9190
9318
|
}
|
|
9191
9319
|
function referenceJson(reference) {
|
|
9192
9320
|
return {
|
|
@@ -9217,7 +9345,7 @@ function toDocumentJson2(document2) {
|
|
|
9217
9345
|
}
|
|
9218
9346
|
|
|
9219
9347
|
// src/document2/keys.ts
|
|
9220
|
-
var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}
|
|
9348
|
+
var DOCUMENT2_KEY_PATTERN = /^[\p{L}\p{M}\p{Nd}:._-]+$/u;
|
|
9221
9349
|
function normalizeDocument2Key(key) {
|
|
9222
9350
|
return key.normalize("NFC").trim();
|
|
9223
9351
|
}
|
|
@@ -9835,19 +9963,21 @@ function previewInlines(field, islands, output, equationSide, document2, preview
|
|
|
9835
9963
|
}
|
|
9836
9964
|
function textBlockPreview(block, islands, output, equationSide, document2, previewOptions) {
|
|
9837
9965
|
const inlines = previewInlines(block.field, islands, output, equationSide, document2, previewOptions);
|
|
9966
|
+
const metadata = block.metadata ? { metadata: { ...block.metadata } } : {};
|
|
9838
9967
|
if (block.command === "\\section") {
|
|
9839
|
-
return { kind: "heading", id: block.id, level: 1, inlines };
|
|
9968
|
+
return { kind: "heading", id: block.id, level: 1, inlines, ...metadata };
|
|
9840
9969
|
}
|
|
9841
9970
|
if (block.command === "\\subsection") {
|
|
9842
|
-
return { kind: "heading", id: block.id, level: 2, inlines };
|
|
9971
|
+
return { kind: "heading", id: block.id, level: 2, inlines, ...metadata };
|
|
9843
9972
|
}
|
|
9844
9973
|
if (block.command === "\\subsubsection") {
|
|
9845
|
-
return { kind: "heading", id: block.id, level: 3, inlines };
|
|
9974
|
+
return { kind: "heading", id: block.id, level: 3, inlines, ...metadata };
|
|
9846
9975
|
}
|
|
9847
9976
|
return {
|
|
9848
9977
|
kind: "paragraph",
|
|
9849
9978
|
id: block.id,
|
|
9850
9979
|
inlines,
|
|
9980
|
+
...metadata,
|
|
9851
9981
|
...block.centered ? { centered: true } : {}
|
|
9852
9982
|
};
|
|
9853
9983
|
}
|
|
@@ -9878,7 +10008,8 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
9878
10008
|
id: item.id,
|
|
9879
10009
|
inlines: previewInlines(item.field, islands, output, equationSide, document2, previewOptions),
|
|
9880
10010
|
blocks: item.blocks.map((child) => blockPreview(child, islands, output, equationSide, document2, previewOptions))
|
|
9881
|
-
}))
|
|
10011
|
+
})),
|
|
10012
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9882
10013
|
};
|
|
9883
10014
|
}
|
|
9884
10015
|
if (block.kind === "table") {
|
|
@@ -9888,7 +10019,8 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
9888
10019
|
id: block.id,
|
|
9889
10020
|
rows: block.rows.map((row) => row.map((cell) => previewInlines(cell, islands, output, equationSide, document2, previewOptions))),
|
|
9890
10021
|
...block.captionEnabled && block.caption.trim().length > 0 ? { caption: block.caption.trim() } : {},
|
|
9891
|
-
...label.length > 0 ? { label, numberLabel: floatNumberLabel(document2, label, previewOptions) } : {}
|
|
10022
|
+
...label.length > 0 ? { label, numberLabel: floatNumberLabel(document2, label, previewOptions) } : {},
|
|
10023
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9892
10024
|
};
|
|
9893
10025
|
}
|
|
9894
10026
|
if (block.kind === "image") {
|
|
@@ -9900,7 +10032,8 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
9900
10032
|
...block.assetId !== void 0 ? { assetId: block.assetId } : {},
|
|
9901
10033
|
options: block.options,
|
|
9902
10034
|
...block.captionEnabled && block.caption.trim().length > 0 ? { caption: block.caption.trim() } : {},
|
|
9903
|
-
...label.length > 0 ? { label, numberLabel: floatNumberLabel(document2, label, previewOptions) } : {}
|
|
10035
|
+
...label.length > 0 ? { label, numberLabel: floatNumberLabel(document2, label, previewOptions) } : {},
|
|
10036
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9904
10037
|
};
|
|
9905
10038
|
}
|
|
9906
10039
|
if (block.kind === "bibliography") {
|
|
@@ -9920,10 +10053,11 @@ function blockPreview(block, islands, output, equationSide, document2, previewOp
|
|
|
9920
10053
|
url: reference.url,
|
|
9921
10054
|
venue: reference.venue,
|
|
9922
10055
|
fieldSeparator: reference.fieldSeparator
|
|
9923
|
-
}))
|
|
10056
|
+
})),
|
|
10057
|
+
...block.metadata ? { metadata: { ...block.metadata } } : {}
|
|
9924
10058
|
};
|
|
9925
10059
|
}
|
|
9926
|
-
return { kind: "omit", id: block.id };
|
|
10060
|
+
return { kind: "omit", id: block.id, ...block.metadata ? { metadata: { ...block.metadata } } : {} };
|
|
9927
10061
|
}
|
|
9928
10062
|
function articleChromePreview(document2, uiLocale, previewOptions) {
|
|
9929
10063
|
const meta = document2.meta ?? emptyDocument2Meta();
|
|
@@ -10071,7 +10205,7 @@ var DOCUMENT2_MESSAGES = {
|
|
|
10071
10205
|
editInternalRef: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0631\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A",
|
|
10072
10206
|
deleteInternalRef: "\u062D\u0630\u0641 \u0627\u0644\u0645\u0631\u062C\u0639 \u0627\u0644\u062F\u0627\u062E\u0644\u064A",
|
|
10073
10207
|
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",
|
|
10074
|
-
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 \
|
|
10208
|
+
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.",
|
|
10075
10209
|
captionToggle: "\u062A\u0639\u0644\u064A\u0642",
|
|
10076
10210
|
labelToggle: "\u062A\u0633\u0645\u064A\u0629",
|
|
10077
10211
|
centerParagraph: "\u062A\u0648\u0633\u064A\u0637 \u0627\u0644\u0641\u0642\u0631\u0629",
|
|
@@ -10515,7 +10649,7 @@ function parseJsonDebugInput(text) {
|
|
|
10515
10649
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
10516
10650
|
|
|
10517
10651
|
// src/react-document2/InlineField.tsx
|
|
10518
|
-
import { useRef as useRef3 } from "react";
|
|
10652
|
+
import { Fragment, useRef as useRef3 } from "react";
|
|
10519
10653
|
|
|
10520
10654
|
// src/react-document2/CiteChip.tsx
|
|
10521
10655
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -11199,8 +11333,14 @@ function RefChip({
|
|
|
11199
11333
|
] });
|
|
11200
11334
|
}
|
|
11201
11335
|
|
|
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
|
+
|
|
11202
11342
|
// src/react-document2/InlineField.tsx
|
|
11203
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
11343
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
11204
11344
|
function rememberCaret(element, blockId, fieldId, tokenId, onFieldFocus) {
|
|
11205
11345
|
if (!blockId || !onFieldFocus) {
|
|
11206
11346
|
return;
|
|
@@ -11218,6 +11358,9 @@ function fitTextareaHeight(element) {
|
|
|
11218
11358
|
element.style.height = "auto";
|
|
11219
11359
|
element.style.height = `${String(element.scrollHeight)}px`;
|
|
11220
11360
|
}
|
|
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
|
+
}
|
|
11221
11364
|
function InlineField({
|
|
11222
11365
|
field,
|
|
11223
11366
|
blockId,
|
|
@@ -11336,74 +11479,92 @@ function InlineField({
|
|
|
11336
11479
|
const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
11337
11480
|
return /* @__PURE__ */ jsx6("div", { className: "butex-document2-widget__inline-field", dir: documentDirection, "data-document-direction": documentDirection, children: field.tokens.map((token) => {
|
|
11338
11481
|
if (token.kind === "text") {
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
} else {
|
|
11379
|
-
focusRefToken(next.id);
|
|
11380
|
-
}
|
|
11482
|
+
const unsupportedEmoji = hasXeLatexUnsupportedEmoji(token.text);
|
|
11483
|
+
const errorId = `butex-document2-xelatex-text-error-${token.id}`;
|
|
11484
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
11485
|
+
/* @__PURE__ */ jsx6(
|
|
11486
|
+
"textarea",
|
|
11487
|
+
{
|
|
11488
|
+
className: "butex-document2-widget__inline-text",
|
|
11489
|
+
value: token.text,
|
|
11490
|
+
"data-bold": token.style?.bold === true ? "true" : void 0,
|
|
11491
|
+
"data-italic": token.style?.italic === true ? "true" : void 0,
|
|
11492
|
+
"data-underline": token.style?.underline === true ? "true" : void 0,
|
|
11493
|
+
dir: documentDirection,
|
|
11494
|
+
"aria-label": messages.text,
|
|
11495
|
+
"aria-invalid": unsupportedEmoji ? true : void 0,
|
|
11496
|
+
"aria-describedby": unsupportedEmoji ? errorId : void 0,
|
|
11497
|
+
rows: 1,
|
|
11498
|
+
"data-field-id": field.id,
|
|
11499
|
+
"data-text-token-id": token.id,
|
|
11500
|
+
style: unsupportedEmoji ? {
|
|
11501
|
+
borderColor: "var(--butex-document2-error)",
|
|
11502
|
+
background: "var(--butex-document2-error-bg)"
|
|
11503
|
+
} : void 0,
|
|
11504
|
+
ref: (element) => {
|
|
11505
|
+
if (element) {
|
|
11506
|
+
textRefs.current.set(token.id, element);
|
|
11507
|
+
fitTextareaHeight(element);
|
|
11508
|
+
} else {
|
|
11509
|
+
textRefs.current.delete(token.id);
|
|
11510
|
+
}
|
|
11511
|
+
},
|
|
11512
|
+
onChange: (event) => {
|
|
11513
|
+
onTextChange(field.id, token.id, event.currentTarget.value);
|
|
11514
|
+
fitTextareaHeight(event.currentTarget);
|
|
11515
|
+
},
|
|
11516
|
+
onKeyDown: (event) => {
|
|
11517
|
+
const element = event.currentTarget;
|
|
11518
|
+
const collapsed = element.selectionStart === element.selectionEnd;
|
|
11519
|
+
if (!collapsed) {
|
|
11520
|
+
return;
|
|
11381
11521
|
}
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11522
|
+
if (event.key === forwardArrowKey && element.selectionStart === element.value.length) {
|
|
11523
|
+
const next = adjacentIslandId(token.id, 1);
|
|
11524
|
+
if (next) {
|
|
11525
|
+
event.preventDefault();
|
|
11526
|
+
if (next.kind === "math") {
|
|
11527
|
+
focusMathToken(next.id);
|
|
11528
|
+
} else if (next.kind === "cite") {
|
|
11529
|
+
focusCiteToken(next.id);
|
|
11530
|
+
} else {
|
|
11531
|
+
focusRefToken(next.id);
|
|
11532
|
+
}
|
|
11533
|
+
}
|
|
11534
|
+
} else if (event.key === backwardArrowKey && element.selectionStart === 0) {
|
|
11535
|
+
const previous = adjacentIslandId(token.id, -1);
|
|
11536
|
+
if (previous) {
|
|
11537
|
+
event.preventDefault();
|
|
11538
|
+
if (previous.kind === "math") {
|
|
11539
|
+
focusMathToken(previous.id);
|
|
11540
|
+
} else if (previous.kind === "cite") {
|
|
11541
|
+
focusCiteToken(previous.id);
|
|
11542
|
+
} else {
|
|
11543
|
+
focusRefToken(previous.id);
|
|
11544
|
+
}
|
|
11392
11545
|
}
|
|
11393
11546
|
}
|
|
11394
|
-
}
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11547
|
+
},
|
|
11548
|
+
onFocus: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
|
|
11549
|
+
onClick: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
|
|
11550
|
+
onKeyUp: (event) => {
|
|
11551
|
+
rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus);
|
|
11552
|
+
fitTextareaHeight(event.currentTarget);
|
|
11553
|
+
},
|
|
11554
|
+
onSelect: (event) => rememberCaret(event.currentTarget, blockId, field.id, token.id, onFieldFocus),
|
|
11555
|
+
onBlur: () => onFieldBlur?.()
|
|
11556
|
+
}
|
|
11557
|
+
),
|
|
11558
|
+
unsupportedEmoji ? /* @__PURE__ */ jsx6(
|
|
11559
|
+
"p",
|
|
11560
|
+
{
|
|
11561
|
+
id: errorId,
|
|
11562
|
+
className: "butex-document2-widget__field-error",
|
|
11563
|
+
style: { flexBasis: "100%" },
|
|
11564
|
+
children: xeLatexUnsupportedEmojiMessage(uiLocale)
|
|
11565
|
+
}
|
|
11566
|
+
) : null
|
|
11567
|
+
] }, token.id);
|
|
11407
11568
|
}
|
|
11408
11569
|
if (token.kind === "cite") {
|
|
11409
11570
|
return /* @__PURE__ */ jsx6(
|
|
@@ -11504,7 +11665,7 @@ function uiLocaleDirection(locale) {
|
|
|
11504
11665
|
}
|
|
11505
11666
|
|
|
11506
11667
|
// src/react-document2/BlockEditor.tsx
|
|
11507
|
-
import { Fragment, jsx as jsx7, jsxs as
|
|
11668
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
11508
11669
|
function blockChromeClass(block) {
|
|
11509
11670
|
const root = "butex-document2-widget__block";
|
|
11510
11671
|
if (block.kind === "textBlock") {
|
|
@@ -11618,8 +11779,8 @@ function FloatMetaEditor({
|
|
|
11618
11779
|
labels,
|
|
11619
11780
|
excludeOwnerId: ownerId
|
|
11620
11781
|
}) : null;
|
|
11621
|
-
return /* @__PURE__ */
|
|
11622
|
-
/* @__PURE__ */
|
|
11782
|
+
return /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__float-meta", children: [
|
|
11783
|
+
/* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__float-meta-toggle", children: [
|
|
11623
11784
|
/* @__PURE__ */ jsx7(
|
|
11624
11785
|
"input",
|
|
11625
11786
|
{
|
|
@@ -11633,7 +11794,7 @@ function FloatMetaEditor({
|
|
|
11633
11794
|
),
|
|
11634
11795
|
/* @__PURE__ */ jsx7("span", { children: messages.captionToggle })
|
|
11635
11796
|
] }),
|
|
11636
|
-
captionEnabled ? /* @__PURE__ */
|
|
11797
|
+
captionEnabled ? /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__refs-field", children: [
|
|
11637
11798
|
/* @__PURE__ */ jsx7("span", { children: messages.floatCaption }),
|
|
11638
11799
|
/* @__PURE__ */ jsx7(
|
|
11639
11800
|
"input",
|
|
@@ -11648,7 +11809,7 @@ function FloatMetaEditor({
|
|
|
11648
11809
|
}
|
|
11649
11810
|
)
|
|
11650
11811
|
] }) : null,
|
|
11651
|
-
/* @__PURE__ */
|
|
11812
|
+
/* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__float-meta-toggle", children: [
|
|
11652
11813
|
/* @__PURE__ */ jsx7(
|
|
11653
11814
|
"input",
|
|
11654
11815
|
{
|
|
@@ -11662,7 +11823,7 @@ function FloatMetaEditor({
|
|
|
11662
11823
|
),
|
|
11663
11824
|
/* @__PURE__ */ jsx7("span", { children: messages.labelToggle })
|
|
11664
11825
|
] }),
|
|
11665
|
-
labelEnabled ? /* @__PURE__ */
|
|
11826
|
+
labelEnabled ? /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__refs-field", children: [
|
|
11666
11827
|
/* @__PURE__ */ jsx7("span", { children: messages.floatLabel }),
|
|
11667
11828
|
/* @__PURE__ */ jsx7(
|
|
11668
11829
|
"input",
|
|
@@ -11771,23 +11932,23 @@ function ImageAssetEditor({
|
|
|
11771
11932
|
document.getElementById(selectId)?.focus();
|
|
11772
11933
|
}
|
|
11773
11934
|
}
|
|
11774
|
-
const defaultUi = /* @__PURE__ */
|
|
11775
|
-
/* @__PURE__ */ jsx7("div", { className: `butex-document2-widget__image-asset ${hasImage ? "butex-document2-widget__image-asset--filled" : "butex-document2-widget__image-asset--empty"}`, children: hasImage ? /* @__PURE__ */
|
|
11935
|
+
const defaultUi = /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-editor", children: [
|
|
11936
|
+
/* @__PURE__ */ jsx7("div", { className: `butex-document2-widget__image-asset ${hasImage ? "butex-document2-widget__image-asset--filled" : "butex-document2-widget__image-asset--empty"}`, children: hasImage ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
11776
11937
|
resolvedUrl ? /* @__PURE__ */ jsx7("img", { className: "butex-document2-widget__image-thumb", src: resolvedUrl, alt: messages.imagePreviewAlt }) : null,
|
|
11777
|
-
/* @__PURE__ */
|
|
11938
|
+
/* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-asset-main", children: [
|
|
11778
11939
|
/* @__PURE__ */ jsx7("span", { className: "butex-document2-widget__image-asset-title", dir: "ltr", children: block.assetId ?? block.value }),
|
|
11779
|
-
/* @__PURE__ */
|
|
11940
|
+
/* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-actions", children: [
|
|
11780
11941
|
/* @__PURE__ */ jsx7("button", { type: "button", onClick: activateImagePicker, disabled: !canUsePicker && !canSelectListedAsset, children: messages.changeImage }),
|
|
11781
11942
|
/* @__PURE__ */ jsx7("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onClearAsset?.(block.id), children: messages.removeImage })
|
|
11782
11943
|
] })
|
|
11783
11944
|
] })
|
|
11784
|
-
] }) : /* @__PURE__ */
|
|
11945
|
+
] }) : /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__image-empty-content", children: [
|
|
11785
11946
|
/* @__PURE__ */ jsx7("strong", { children: messages.noImageSelected }),
|
|
11786
11947
|
/* @__PURE__ */ jsx7("button", { type: "button", onClick: activateImagePicker, disabled: !canUsePicker && !canSelectListedAsset, children: messages.chooseImage })
|
|
11787
11948
|
] }) }),
|
|
11788
|
-
!canUsePicker ? /* @__PURE__ */
|
|
11949
|
+
!canUsePicker ? /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__image-select", htmlFor: selectId, children: [
|
|
11789
11950
|
/* @__PURE__ */ jsx7("span", { children: messages.selectImageAsset }),
|
|
11790
|
-
/* @__PURE__ */
|
|
11951
|
+
/* @__PURE__ */ jsxs6(
|
|
11791
11952
|
"select",
|
|
11792
11953
|
{
|
|
11793
11954
|
id: selectId,
|
|
@@ -11802,7 +11963,7 @@ function ImageAssetEditor({
|
|
|
11802
11963
|
}
|
|
11803
11964
|
)
|
|
11804
11965
|
] }) : null,
|
|
11805
|
-
/* @__PURE__ */
|
|
11966
|
+
/* @__PURE__ */ jsxs6(
|
|
11806
11967
|
"details",
|
|
11807
11968
|
{
|
|
11808
11969
|
className: "butex-document2-widget__image-advanced",
|
|
@@ -11839,7 +12000,7 @@ function ImageAssetEditor({
|
|
|
11839
12000
|
)
|
|
11840
12001
|
] });
|
|
11841
12002
|
if (renderImageBlockEditor) {
|
|
11842
|
-
return /* @__PURE__ */ jsx7(
|
|
12003
|
+
return /* @__PURE__ */ jsx7(Fragment2, { children: renderImageBlockEditor({
|
|
11843
12004
|
blockId: block.id,
|
|
11844
12005
|
assetId: block.assetId,
|
|
11845
12006
|
value: block.value,
|
|
@@ -11850,7 +12011,7 @@ function ImageAssetEditor({
|
|
|
11850
12011
|
defaultUi
|
|
11851
12012
|
}) });
|
|
11852
12013
|
}
|
|
11853
|
-
return /* @__PURE__ */ jsx7(
|
|
12014
|
+
return /* @__PURE__ */ jsx7(Fragment2, { children: defaultUi });
|
|
11854
12015
|
}
|
|
11855
12016
|
function blockSummary(block, referenceCount, messages) {
|
|
11856
12017
|
if (block.kind === "textBlock") {
|
|
@@ -11957,7 +12118,7 @@ function BlockEditor({
|
|
|
11957
12118
|
}
|
|
11958
12119
|
onBlockFocus?.(block.id);
|
|
11959
12120
|
},
|
|
11960
|
-
children: /* @__PURE__ */
|
|
12121
|
+
children: /* @__PURE__ */ jsxs6("span", { className: "butex-document2-widget__block-title", children: [
|
|
11961
12122
|
onToggleSelect ? /* @__PURE__ */ jsx7(
|
|
11962
12123
|
"input",
|
|
11963
12124
|
{
|
|
@@ -11993,16 +12154,16 @@ function BlockEditor({
|
|
|
11993
12154
|
}
|
|
11994
12155
|
) : null;
|
|
11995
12156
|
if (isCollapsed && showChrome) {
|
|
11996
|
-
return /* @__PURE__ */
|
|
12157
|
+
return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
11997
12158
|
header,
|
|
11998
12159
|
/* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__block-summary", children: blockSummary(block, references.length, messages) })
|
|
11999
12160
|
] });
|
|
12000
12161
|
}
|
|
12001
12162
|
if (block.kind === "textBlock") {
|
|
12002
|
-
return /* @__PURE__ */
|
|
12163
|
+
return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
12003
12164
|
header,
|
|
12004
12165
|
/* @__PURE__ */ jsx7(InlineField, { field: block.field, ...fieldProps }),
|
|
12005
|
-
block.command === "\\paragraph" ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__float-meta butex-document2-widget__float-meta--compact", children: /* @__PURE__ */
|
|
12166
|
+
block.command === "\\paragraph" ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__float-meta butex-document2-widget__float-meta--compact", children: /* @__PURE__ */ jsxs6("label", { className: "butex-document2-widget__float-meta-toggle", children: [
|
|
12006
12167
|
/* @__PURE__ */ jsx7(
|
|
12007
12168
|
"input",
|
|
12008
12169
|
{
|
|
@@ -12019,11 +12180,11 @@ function BlockEditor({
|
|
|
12019
12180
|
] });
|
|
12020
12181
|
}
|
|
12021
12182
|
if (block.kind === "list") {
|
|
12022
|
-
return /* @__PURE__ */
|
|
12183
|
+
return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
12023
12184
|
header,
|
|
12024
|
-
block.items.map((item, index) => /* @__PURE__ */
|
|
12185
|
+
block.items.map((item, index) => /* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__field", dir: "rtl", children: [
|
|
12025
12186
|
/* @__PURE__ */ jsx7("span", { className: "butex-document2-widget__toolbar-label", children: block.command === "\\begin{enumerate}" ? `${messages.item} ${String(index + 1)}` : messages.item }),
|
|
12026
|
-
/* @__PURE__ */
|
|
12187
|
+
/* @__PURE__ */ jsxs6("div", { className: "butex-document2-widget__list-item-content", dir: documentDirection, children: [
|
|
12027
12188
|
/* @__PURE__ */ jsx7(InlineField, { field: item.field, ...fieldProps }),
|
|
12028
12189
|
item.blocks.map((child) => /* @__PURE__ */ jsx7(
|
|
12029
12190
|
BlockEditor,
|
|
@@ -12063,14 +12224,14 @@ function BlockEditor({
|
|
|
12063
12224
|
] }),
|
|
12064
12225
|
onRemoveListItem && block.items.length > 1 ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__list-item-actions", children: /* @__PURE__ */ jsx7("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveListItem(block.id, item.id), children: messages.deleteItem }) }) : null
|
|
12065
12226
|
] }, item.id)),
|
|
12066
|
-
onAddListItem ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */
|
|
12227
|
+
onAddListItem ? /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */ jsxs6("button", { type: "button", onClick: () => onAddListItem(block.id), children: [
|
|
12067
12228
|
"+ ",
|
|
12068
12229
|
messages.addItem
|
|
12069
12230
|
] }) }) : null
|
|
12070
12231
|
] });
|
|
12071
12232
|
}
|
|
12072
12233
|
if (block.kind === "table") {
|
|
12073
|
-
return /* @__PURE__ */
|
|
12234
|
+
return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
12074
12235
|
header,
|
|
12075
12236
|
block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__row", dir: documentDirection, children: row.map((cell) => /* @__PURE__ */ jsx7("div", { className: "butex-document2-widget__table-cell", dir: documentDirection, children: /* @__PURE__ */ jsx7(InlineField, { field: cell, ...fieldProps }) }, cell.id)) }, rowIndex)),
|
|
12076
12237
|
/* @__PURE__ */ jsx7(
|
|
@@ -12092,7 +12253,7 @@ function BlockEditor({
|
|
|
12092
12253
|
] });
|
|
12093
12254
|
}
|
|
12094
12255
|
if (block.kind === "image") {
|
|
12095
|
-
return /* @__PURE__ */
|
|
12256
|
+
return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
12096
12257
|
header,
|
|
12097
12258
|
/* @__PURE__ */ jsx7(
|
|
12098
12259
|
ImageAssetEditor,
|
|
@@ -12129,10 +12290,10 @@ function BlockEditor({
|
|
|
12129
12290
|
] });
|
|
12130
12291
|
}
|
|
12131
12292
|
if (block.kind === "bibliography") {
|
|
12132
|
-
return /* @__PURE__ */
|
|
12293
|
+
return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
12133
12294
|
header,
|
|
12134
|
-
/* @__PURE__ */ jsx7("ol", { className: "butex-document2-widget__bibliography-editor", dir: documentDirection, children: referenceList.map((reference, index) => /* @__PURE__ */
|
|
12135
|
-
/* @__PURE__ */
|
|
12295
|
+
/* @__PURE__ */ jsx7("ol", { className: "butex-document2-widget__bibliography-editor", dir: documentDirection, children: referenceList.map((reference, index) => /* @__PURE__ */ jsxs6("li", { children: [
|
|
12296
|
+
/* @__PURE__ */ jsxs6("strong", { children: [
|
|
12136
12297
|
"[",
|
|
12137
12298
|
formatBibliographyNumber(index + 1, { documentDirection, digitForm }),
|
|
12138
12299
|
"] ",
|
|
@@ -12145,7 +12306,7 @@ function BlockEditor({
|
|
|
12145
12306
|
onManageReferences ? /* @__PURE__ */ jsx7("button", { type: "button", onClick: onManageReferences, children: messages.manageReferences }) : null
|
|
12146
12307
|
] });
|
|
12147
12308
|
}
|
|
12148
|
-
return /* @__PURE__ */
|
|
12309
|
+
return /* @__PURE__ */ jsxs6("section", { className: chromeClass, "data-butex-block-source": block.metadata?.source, children: [
|
|
12149
12310
|
header,
|
|
12150
12311
|
/* @__PURE__ */ jsx7("pre", { className: "butex-document2-widget__raw", children: block.value })
|
|
12151
12312
|
] });
|
|
@@ -12153,7 +12314,7 @@ function BlockEditor({
|
|
|
12153
12314
|
|
|
12154
12315
|
// src/react-document2/CitePickerPopover.tsx
|
|
12155
12316
|
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
12156
|
-
import { jsx as jsx8, jsxs as
|
|
12317
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
12157
12318
|
function CitePickerPopover({
|
|
12158
12319
|
open,
|
|
12159
12320
|
references,
|
|
@@ -12178,7 +12339,7 @@ function CitePickerPopover({
|
|
|
12178
12339
|
function toggleKey(key) {
|
|
12179
12340
|
setSelected((current) => current.includes(key) ? current.filter((entry) => entry !== key) : [...current, key]);
|
|
12180
12341
|
}
|
|
12181
|
-
return /* @__PURE__ */ jsx8("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */
|
|
12342
|
+
return /* @__PURE__ */ jsx8("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs7(
|
|
12182
12343
|
"div",
|
|
12183
12344
|
{
|
|
12184
12345
|
className: "butex-document2-widget__cite-picker",
|
|
@@ -12186,7 +12347,7 @@ function CitePickerPopover({
|
|
|
12186
12347
|
"aria-label": messages.citePickerTitle,
|
|
12187
12348
|
onClick: (event) => event.stopPropagation(),
|
|
12188
12349
|
children: [
|
|
12189
|
-
/* @__PURE__ */
|
|
12350
|
+
/* @__PURE__ */ jsxs7("header", { className: "butex-document2-widget__cite-picker-header", children: [
|
|
12190
12351
|
/* @__PURE__ */ jsx8("strong", { children: messages.citePickerTitle }),
|
|
12191
12352
|
/* @__PURE__ */ jsx8("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
|
|
12192
12353
|
] }),
|
|
@@ -12194,10 +12355,10 @@ function CitePickerPopover({
|
|
|
12194
12355
|
const checked = selected.includes(reference.key);
|
|
12195
12356
|
const subtitle = [reference.authors, reference.title].filter(Boolean).join(" \u2014 ");
|
|
12196
12357
|
const numberLabel = formatBibliographyNumber(index + 1, { documentDirection, digitForm });
|
|
12197
|
-
return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */
|
|
12358
|
+
return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs7("label", { className: "butex-document2-widget__cite-picker-item", children: [
|
|
12198
12359
|
/* @__PURE__ */ jsx8("input", { type: "checkbox", checked, onChange: () => toggleKey(reference.key) }),
|
|
12199
|
-
/* @__PURE__ */
|
|
12200
|
-
/* @__PURE__ */
|
|
12360
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
12361
|
+
/* @__PURE__ */ jsxs7("strong", { children: [
|
|
12201
12362
|
"[",
|
|
12202
12363
|
numberLabel,
|
|
12203
12364
|
"] ",
|
|
@@ -12207,7 +12368,7 @@ function CitePickerPopover({
|
|
|
12207
12368
|
] })
|
|
12208
12369
|
] }) }, reference.id);
|
|
12209
12370
|
}) }),
|
|
12210
|
-
/* @__PURE__ */
|
|
12371
|
+
/* @__PURE__ */ jsxs7("footer", { className: "butex-document2-widget__cite-picker-footer", children: [
|
|
12211
12372
|
onManageReferences ? /* @__PURE__ */ jsx8("button", { type: "button", onClick: onManageReferences, children: messages.manageReferences }) : null,
|
|
12212
12373
|
/* @__PURE__ */ jsx8("button", { type: "button", onClick: onClose, children: messages.close }),
|
|
12213
12374
|
/* @__PURE__ */ jsx8(
|
|
@@ -12231,7 +12392,7 @@ import { useEffect as useEffect6, useRef as useRef5, useState as useState6 } fro
|
|
|
12231
12392
|
|
|
12232
12393
|
// src/react-document2/TableInsertPopover.tsx
|
|
12233
12394
|
import { useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
|
|
12234
|
-
import { jsx as jsx9, jsxs as
|
|
12395
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
12235
12396
|
function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
|
|
12236
12397
|
const messages = document2Messages(uiLocale);
|
|
12237
12398
|
const [open, setOpen] = useState5(false);
|
|
@@ -12256,7 +12417,7 @@ function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
|
|
|
12256
12417
|
onConfirm(rowCount, colCount);
|
|
12257
12418
|
setOpen(false);
|
|
12258
12419
|
}
|
|
12259
|
-
return /* @__PURE__ */
|
|
12420
|
+
return /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__table-popover", ref: rootRef, children: [
|
|
12260
12421
|
/* @__PURE__ */ jsx9(
|
|
12261
12422
|
"button",
|
|
12262
12423
|
{
|
|
@@ -12270,12 +12431,12 @@ function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
|
|
|
12270
12431
|
children: "\u229E"
|
|
12271
12432
|
}
|
|
12272
12433
|
),
|
|
12273
|
-
open ? /* @__PURE__ */
|
|
12274
|
-
/* @__PURE__ */
|
|
12434
|
+
open ? /* @__PURE__ */ jsxs8("div", { className: "butex-document2-widget__table-popover-panel", role: "dialog", "aria-label": messages.tableSize, children: [
|
|
12435
|
+
/* @__PURE__ */ jsxs8("label", { children: [
|
|
12275
12436
|
messages.rows,
|
|
12276
12437
|
/* @__PURE__ */ jsx9("input", { type: "number", min: 1, max: 20, value: rows, onChange: (event) => setRows(event.currentTarget.value) })
|
|
12277
12438
|
] }),
|
|
12278
|
-
/* @__PURE__ */
|
|
12439
|
+
/* @__PURE__ */ jsxs8("label", { children: [
|
|
12279
12440
|
messages.columns,
|
|
12280
12441
|
/* @__PURE__ */ jsx9("input", { type: "number", min: 1, max: 10, value: cols, onChange: (event) => setCols(event.currentTarget.value) })
|
|
12281
12442
|
] }),
|
|
@@ -12285,7 +12446,7 @@ function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
|
|
|
12285
12446
|
}
|
|
12286
12447
|
|
|
12287
12448
|
// src/react-document2/DocumentInsertToolbar.tsx
|
|
12288
|
-
import { jsx as jsx10, jsxs as
|
|
12449
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
12289
12450
|
var DIGIT_FORMS = ["western", "arabicIndic", "persianIndic"];
|
|
12290
12451
|
function digitFormLabel(digitForm) {
|
|
12291
12452
|
if (digitForm === "arabicIndic") {
|
|
@@ -12392,12 +12553,12 @@ function DocumentInsertToolbar({
|
|
|
12392
12553
|
}
|
|
12393
12554
|
return messages.westernDigits;
|
|
12394
12555
|
}
|
|
12395
|
-
return /* @__PURE__ */
|
|
12396
|
-
/* @__PURE__ */
|
|
12556
|
+
return /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-insert", children: [
|
|
12557
|
+
/* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.undoRedo, children: [
|
|
12397
12558
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.undo} (Ctrl+Z)`, "aria-label": messages.undo, disabled: !canUndo, onClick: onUndo, children: "\u21B6" }),
|
|
12398
12559
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.redo} (Ctrl+Shift+Z)`, "aria-label": messages.redo, disabled: !canRedo, onClick: onRedo, children: "\u21B7" })
|
|
12399
12560
|
] }),
|
|
12400
|
-
/* @__PURE__ */
|
|
12561
|
+
/* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.blockSelection, children: [
|
|
12401
12562
|
/* @__PURE__ */ jsx10(
|
|
12402
12563
|
"button",
|
|
12403
12564
|
{
|
|
@@ -12434,13 +12595,13 @@ function DocumentInsertToolbar({
|
|
|
12434
12595
|
children: messages.deleteBlock
|
|
12435
12596
|
}
|
|
12436
12597
|
),
|
|
12437
|
-
selectionCount > 0 ? /* @__PURE__ */
|
|
12598
|
+
selectionCount > 0 ? /* @__PURE__ */ jsxs9("span", { className: "butex-document2-widget__selection-count", children: [
|
|
12438
12599
|
selectionCount,
|
|
12439
12600
|
" ",
|
|
12440
12601
|
messages.selectedBlockCount
|
|
12441
12602
|
] }) : null
|
|
12442
12603
|
] }),
|
|
12443
|
-
/* @__PURE__ */
|
|
12604
|
+
/* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.textFormatting, children: [
|
|
12444
12605
|
/* @__PURE__ */ jsx10(
|
|
12445
12606
|
"button",
|
|
12446
12607
|
{
|
|
@@ -12484,7 +12645,7 @@ function DocumentInsertToolbar({
|
|
|
12484
12645
|
}
|
|
12485
12646
|
)
|
|
12486
12647
|
] }),
|
|
12487
|
-
/* @__PURE__ */
|
|
12648
|
+
/* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.structure, children: [
|
|
12488
12649
|
/* @__PURE__ */ jsx10(
|
|
12489
12650
|
"button",
|
|
12490
12651
|
{
|
|
@@ -12501,10 +12662,10 @@ function DocumentInsertToolbar({
|
|
|
12501
12662
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h3", title: messages.addSubsubsection, "aria-label": messages.addSubsubsection, onClick: onAddSubsubsection, children: messages.subsubsectionGlyph }),
|
|
12502
12663
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.addParagraph, "aria-label": messages.addParagraph, onClick: onAddParagraph, children: messages.paragraphGlyph })
|
|
12503
12664
|
] }),
|
|
12504
|
-
/* @__PURE__ */
|
|
12665
|
+
/* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.equations, children: [
|
|
12505
12666
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.inlineEquation} ($\u2026$)`, "aria-label": messages.inlineEquation, disabled: !editableEquations, onClick: onAddInlineEquation, children: /* @__PURE__ */ jsx10("span", { className: "butex-document2-widget__icon-math-inline", "aria-hidden": "true", children: "$=$" }) }),
|
|
12506
12667
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.displayEquation} (\\[\u2026\\])`, "aria-label": messages.displayEquation, disabled: !editableEquations, onClick: onAddDisplayEquation, children: /* @__PURE__ */ jsx10("span", { className: "butex-document2-widget__icon-math-display", "aria-hidden": "true", children: "\\[\xF7\\]" }) }),
|
|
12507
|
-
/* @__PURE__ */
|
|
12668
|
+
/* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__digit-form-menu", children: [
|
|
12508
12669
|
/* @__PURE__ */ jsx10(
|
|
12509
12670
|
"button",
|
|
12510
12671
|
{
|
|
@@ -12535,8 +12696,8 @@ function DocumentInsertToolbar({
|
|
|
12535
12696
|
)) }) : null
|
|
12536
12697
|
] })
|
|
12537
12698
|
] }),
|
|
12538
|
-
/* @__PURE__ */ jsx10("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.citations, children: /* @__PURE__ */
|
|
12539
|
-
/* @__PURE__ */
|
|
12699
|
+
/* @__PURE__ */ jsx10("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.citations, children: /* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__references-menu", ref: referencesMenuRef, children: [
|
|
12700
|
+
/* @__PURE__ */ jsxs9(
|
|
12540
12701
|
"button",
|
|
12541
12702
|
{
|
|
12542
12703
|
ref: referencesTriggerRef,
|
|
@@ -12554,7 +12715,7 @@ function DocumentInsertToolbar({
|
|
|
12554
12715
|
]
|
|
12555
12716
|
}
|
|
12556
12717
|
),
|
|
12557
|
-
referencesMenuOpen ? /* @__PURE__ */
|
|
12718
|
+
referencesMenuOpen ? /* @__PURE__ */ jsxs9(
|
|
12558
12719
|
"div",
|
|
12559
12720
|
{
|
|
12560
12721
|
className: "butex-document2-widget__references-menu-options",
|
|
@@ -12562,23 +12723,23 @@ function DocumentInsertToolbar({
|
|
|
12562
12723
|
"aria-label": messages.citations,
|
|
12563
12724
|
onKeyDown: moveReferenceMenuFocus,
|
|
12564
12725
|
children: [
|
|
12565
|
-
/* @__PURE__ */
|
|
12726
|
+
/* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.insertCitation, onClick: () => runReferenceAction(onInsertCitation), children: [
|
|
12566
12727
|
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "[]" }),
|
|
12567
12728
|
/* @__PURE__ */ jsx10("span", { children: messages.insertCitation })
|
|
12568
12729
|
] }),
|
|
12569
|
-
/* @__PURE__ */
|
|
12730
|
+
/* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.insertInternalRef, onClick: () => runReferenceAction(onInsertInternalRef), children: [
|
|
12570
12731
|
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\xA7" }),
|
|
12571
12732
|
/* @__PURE__ */ jsx10("span", { children: messages.insertInternalRef })
|
|
12572
12733
|
] }),
|
|
12573
|
-
/* @__PURE__ */
|
|
12734
|
+
/* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.insertBibliography, onClick: () => runReferenceAction(onInsertBibliography), children: [
|
|
12574
12735
|
/* @__PURE__ */ jsx10("span", { className: "butex-document2-widget__icon-bibliography", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 16 16", width: "14", height: "14", focusable: "false", children: /* @__PURE__ */ jsx10("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" }) }) }),
|
|
12575
12736
|
/* @__PURE__ */ jsx10("span", { children: messages.insertBibliography })
|
|
12576
12737
|
] }),
|
|
12577
|
-
/* @__PURE__ */
|
|
12738
|
+
/* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.manageReferences, onClick: () => runReferenceAction(onManageReferences), children: [
|
|
12578
12739
|
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2630" }),
|
|
12579
12740
|
/* @__PURE__ */ jsx10("span", { children: messages.manageReferences })
|
|
12580
12741
|
] }),
|
|
12581
|
-
/* @__PURE__ */
|
|
12742
|
+
/* @__PURE__ */ jsxs9("button", { type: "button", role: "menuitem", title: messages.manageLabels, onClick: () => runReferenceAction(onManageLabels), children: [
|
|
12582
12743
|
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2317" }),
|
|
12583
12744
|
/* @__PURE__ */ jsx10("span", { children: messages.manageLabels })
|
|
12584
12745
|
] })
|
|
@@ -12586,7 +12747,7 @@ function DocumentInsertToolbar({
|
|
|
12586
12747
|
}
|
|
12587
12748
|
) : null
|
|
12588
12749
|
] }) }),
|
|
12589
|
-
/* @__PURE__ */
|
|
12750
|
+
/* @__PURE__ */ jsxs9("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.lists, children: [
|
|
12590
12751
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.bulletedList, "aria-label": messages.bulletedList, onClick: onAddList, children: "\u2022\u2261" }),
|
|
12591
12752
|
/* @__PURE__ */ jsx10("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.numberedList, "aria-label": messages.numberedList, onClick: onAddEnumerate, children: "1." })
|
|
12592
12753
|
] }),
|
|
@@ -12596,9 +12757,9 @@ function DocumentInsertToolbar({
|
|
|
12596
12757
|
}
|
|
12597
12758
|
|
|
12598
12759
|
// src/react-document2/DocumentPreview.tsx
|
|
12599
|
-
import { Fragment as
|
|
12760
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
12600
12761
|
function PreviewInlines({ inlines, output }) {
|
|
12601
|
-
return /* @__PURE__ */ jsx11(
|
|
12762
|
+
return /* @__PURE__ */ jsx11(Fragment3, { children: inlines.map((inline, index) => {
|
|
12602
12763
|
if (inline.kind === "text") {
|
|
12603
12764
|
let content = /* @__PURE__ */ jsx11("span", { children: inline.text });
|
|
12604
12765
|
if (inline.style?.bold) {
|
|
@@ -12634,12 +12795,13 @@ function PreviewBlock({
|
|
|
12634
12795
|
}) {
|
|
12635
12796
|
const messages = document2Messages(uiLocale);
|
|
12636
12797
|
const floatCaptionSeparator = uiLocale === "ar" ? ": " : ". ";
|
|
12798
|
+
const source = "metadata" in block ? block.metadata?.source : void 0;
|
|
12637
12799
|
function FloatCaption({ numberLabel, caption }) {
|
|
12638
12800
|
if (!numberLabel && !caption) {
|
|
12639
12801
|
return null;
|
|
12640
12802
|
}
|
|
12641
|
-
return /* @__PURE__ */
|
|
12642
|
-
numberLabel ? /* @__PURE__ */
|
|
12803
|
+
return /* @__PURE__ */ jsxs10("figcaption", { dir: documentDirection, children: [
|
|
12804
|
+
numberLabel ? /* @__PURE__ */ jsxs10("span", { className: "butex-document2-widget__preview-float-number", children: [
|
|
12643
12805
|
numberLabel,
|
|
12644
12806
|
caption ? floatCaptionSeparator : ""
|
|
12645
12807
|
] }) : null,
|
|
@@ -12656,9 +12818,9 @@ function PreviewBlock({
|
|
|
12656
12818
|
);
|
|
12657
12819
|
}
|
|
12658
12820
|
if (block.kind === "titleBlock") {
|
|
12659
|
-
return /* @__PURE__ */
|
|
12821
|
+
return /* @__PURE__ */ jsxs10("header", { className: "butex-document2-widget__preview-title-block", children: [
|
|
12660
12822
|
block.title ? /* @__PURE__ */ jsx11("h1", { className: "butex-document2-widget__preview-article-title", children: block.title }) : null,
|
|
12661
|
-
block.authors ? /* @__PURE__ */ jsx11("p", { className: "butex-document2-widget__preview-article-authors", children: block.authors.split("\n").map((line, index) => /* @__PURE__ */
|
|
12823
|
+
block.authors ? /* @__PURE__ */ jsx11("p", { className: "butex-document2-widget__preview-article-authors", children: block.authors.split("\n").map((line, index) => /* @__PURE__ */ jsxs10("span", { children: [
|
|
12662
12824
|
index > 0 ? /* @__PURE__ */ jsx11("br", {}) : null,
|
|
12663
12825
|
line
|
|
12664
12826
|
] }, index)) }) : null,
|
|
@@ -12666,21 +12828,21 @@ function PreviewBlock({
|
|
|
12666
12828
|
] });
|
|
12667
12829
|
}
|
|
12668
12830
|
if (block.kind === "abstract") {
|
|
12669
|
-
return /* @__PURE__ */
|
|
12831
|
+
return /* @__PURE__ */ jsxs10("section", { className: "butex-document2-widget__preview-abstract", "aria-label": messages.articleAbstract, children: [
|
|
12670
12832
|
/* @__PURE__ */ jsx11("h2", { className: "butex-document2-widget__preview-abstract-label", children: messages.articleAbstract }),
|
|
12671
12833
|
/* @__PURE__ */ jsx11("p", { children: block.text })
|
|
12672
12834
|
] });
|
|
12673
12835
|
}
|
|
12674
12836
|
if (block.kind === "heading") {
|
|
12675
12837
|
const Tag = block.level === 1 ? "h1" : block.level === 2 ? "h2" : "h3";
|
|
12676
|
-
return /* @__PURE__ */ jsx11(Tag, { children: /* @__PURE__ */ jsx11(PreviewInlines, { inlines: block.inlines, output }) });
|
|
12838
|
+
return /* @__PURE__ */ jsx11(Tag, { "data-butex-block-source": source, children: /* @__PURE__ */ jsx11(PreviewInlines, { inlines: block.inlines, output }) });
|
|
12677
12839
|
}
|
|
12678
12840
|
if (block.kind === "paragraph") {
|
|
12679
|
-
return /* @__PURE__ */ jsx11("p", { className: block.centered ? "butex-document2-widget__preview-paragraph--centered" : void 0, children: /* @__PURE__ */ jsx11(PreviewInlines, { inlines: block.inlines, output }) });
|
|
12841
|
+
return /* @__PURE__ */ jsx11("p", { "data-butex-block-source": source, className: block.centered ? "butex-document2-widget__preview-paragraph--centered" : void 0, children: /* @__PURE__ */ jsx11(PreviewInlines, { inlines: block.inlines, output }) });
|
|
12680
12842
|
}
|
|
12681
12843
|
if (block.kind === "list") {
|
|
12682
12844
|
const Tag = block.ordered ? "ol" : "ul";
|
|
12683
|
-
return /* @__PURE__ */ jsx11(Tag, { children: block.items.map((item) => /* @__PURE__ */
|
|
12845
|
+
return /* @__PURE__ */ jsx11(Tag, { "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs10("li", { children: [
|
|
12684
12846
|
/* @__PURE__ */ jsx11(PreviewInlines, { inlines: item.inlines, output }),
|
|
12685
12847
|
item.blocks.map((child) => /* @__PURE__ */ jsx11(
|
|
12686
12848
|
PreviewBlock,
|
|
@@ -12700,28 +12862,28 @@ function PreviewBlock({
|
|
|
12700
12862
|
return null;
|
|
12701
12863
|
}
|
|
12702
12864
|
if (block.kind === "table") {
|
|
12703
|
-
return /* @__PURE__ */
|
|
12865
|
+
return /* @__PURE__ */ jsxs10("figure", { className: "butex-document2-widget__preview-float", "data-butex-block-source": source, children: [
|
|
12704
12866
|
/* @__PURE__ */ jsx11("table", { children: /* @__PURE__ */ jsx11("tbody", { children: block.rows.map((row, rowIndex) => /* @__PURE__ */ jsx11("tr", { children: row.map((cell, columnIndex) => /* @__PURE__ */ jsx11("td", { children: /* @__PURE__ */ jsx11(PreviewInlines, { inlines: cell, output }) }, columnIndex)) }, rowIndex)) }) }),
|
|
12705
12867
|
/* @__PURE__ */ jsx11(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption })
|
|
12706
12868
|
] });
|
|
12707
12869
|
}
|
|
12708
12870
|
if (block.kind === "image") {
|
|
12709
12871
|
const src = resolveImageUrl ? resolveImageUrl({ assetId: block.assetId, value: block.src }) : block.src;
|
|
12710
|
-
return /* @__PURE__ */
|
|
12872
|
+
return /* @__PURE__ */ jsxs10("figure", { className: "butex-document2-widget__preview-float", "data-butex-block-source": source, children: [
|
|
12711
12873
|
/* @__PURE__ */ jsx11("img", { src, alt: block.caption ?? "" }),
|
|
12712
12874
|
/* @__PURE__ */ jsx11(FloatCaption, { numberLabel: block.numberLabel, caption: block.caption })
|
|
12713
12875
|
] });
|
|
12714
12876
|
}
|
|
12715
12877
|
if (block.kind === "bibliography") {
|
|
12716
|
-
return /* @__PURE__ */ jsx11("ol", { className: "butex-document2-widget__preview-bibliography", children: block.items.map((item) => /* @__PURE__ */
|
|
12717
|
-
/* @__PURE__ */
|
|
12878
|
+
return /* @__PURE__ */ jsx11("ol", { className: "butex-document2-widget__preview-bibliography", "data-butex-block-source": source, children: block.items.map((item) => /* @__PURE__ */ jsxs10("li", { children: [
|
|
12879
|
+
/* @__PURE__ */ jsxs10("span", { className: "butex-document2-widget__preview-bib-number", children: [
|
|
12718
12880
|
item.numberLabel,
|
|
12719
12881
|
"."
|
|
12720
12882
|
] }),
|
|
12721
12883
|
" ",
|
|
12722
|
-
/* @__PURE__ */
|
|
12884
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
12723
12885
|
bibliographyEntryBody(item, item.fieldSeparator, { digitForm }),
|
|
12724
|
-
item.url ? /* @__PURE__ */
|
|
12886
|
+
item.url ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
12725
12887
|
" ",
|
|
12726
12888
|
/* @__PURE__ */ jsx11("a", { href: absoluteHttpHref(item.url), target: "_blank", rel: "noreferrer", children: item.url })
|
|
12727
12889
|
] }) : null
|
|
@@ -12741,7 +12903,7 @@ function DocumentPreview({
|
|
|
12741
12903
|
const messages = document2Messages(uiLocale);
|
|
12742
12904
|
const resolvedDigitForm = digitForm ?? (documentDirection === "rtl" ? "arabicIndic" : "western");
|
|
12743
12905
|
const hasBody = blocks.some(isBodyPreviewBlock);
|
|
12744
|
-
return /* @__PURE__ */
|
|
12906
|
+
return /* @__PURE__ */ jsxs10("div", { className: "butex-document2-widget__preview", dir: documentDirection, children: [
|
|
12745
12907
|
blocks.map((block) => /* @__PURE__ */ jsx11(
|
|
12746
12908
|
PreviewBlock,
|
|
12747
12909
|
{
|
|
@@ -13771,7 +13933,7 @@ function injectWidgetChromeCss(doc) {
|
|
|
13771
13933
|
}
|
|
13772
13934
|
|
|
13773
13935
|
// src/react/ButexEditor.tsx
|
|
13774
|
-
import { Fragment as
|
|
13936
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
13775
13937
|
var DIGIT_FORM_OPTIONS = [
|
|
13776
13938
|
{ id: "western", label: "456" },
|
|
13777
13939
|
{ id: "arabicIndic", label: "\u0664\u0665\u0666" },
|
|
@@ -13847,7 +14009,7 @@ function renderArabicCommandLabel(command) {
|
|
|
13847
14009
|
if (command.id !== "ln") {
|
|
13848
14010
|
return command.arabicLabel;
|
|
13849
14011
|
}
|
|
13850
|
-
return /* @__PURE__ */
|
|
14012
|
+
return /* @__PURE__ */ jsxs11("span", { className: "function-command-label-with-sub", "aria-hidden": "true", children: [
|
|
13851
14013
|
/* @__PURE__ */ jsx12("span", { className: "function-command-label-with-sub__base", children: command.arabicLabel }),
|
|
13852
14014
|
/* @__PURE__ */ jsx12("span", { className: "function-command-label-with-sub__sub", children: "\u0647\u0640" })
|
|
13853
14015
|
] });
|
|
@@ -14125,14 +14287,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
14125
14287
|
className: `butex-widget ${className ?? ""}`.trim(),
|
|
14126
14288
|
dir: uiLocaleDirection(uiLocale),
|
|
14127
14289
|
lang: uiLocale,
|
|
14128
|
-
children: /* @__PURE__ */
|
|
14129
|
-
/* @__PURE__ */
|
|
14130
|
-
/* @__PURE__ */
|
|
14131
|
-
/* @__PURE__ */
|
|
14290
|
+
children: /* @__PURE__ */ jsxs11("div", { className: "butex-widget-layout", children: [
|
|
14291
|
+
/* @__PURE__ */ jsxs11("section", { className: "panel", children: [
|
|
14292
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar", children: [
|
|
14293
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
|
|
14132
14294
|
/* @__PURE__ */ jsx12("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: messages.undo, "aria-label": messages.undo, children: "\u21B7" }),
|
|
14133
14295
|
/* @__PURE__ */ jsx12("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: messages.redo, "aria-label": messages.redo, children: "\u21B6" })
|
|
14134
14296
|
] }),
|
|
14135
|
-
/* @__PURE__ */
|
|
14297
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
|
|
14136
14298
|
/* @__PURE__ */ jsx12("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: messages.copy, "aria-label": messages.copy, disabled: true, children: "\u29C9" }),
|
|
14137
14299
|
/* @__PURE__ */ jsx12("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: messages.cut, "aria-label": messages.cut, disabled: true, children: "\u2702" }),
|
|
14138
14300
|
/* @__PURE__ */ jsx12(
|
|
@@ -14153,8 +14315,8 @@ ${arabic || currentMessages.empty}`;
|
|
|
14153
14315
|
)
|
|
14154
14316
|
] }),
|
|
14155
14317
|
/* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.editorSettings, children: /* @__PURE__ */ jsx12("button", { className: "icon-btn accent", type: "button", title: messages.toggleSide, "aria-label": messages.toggleSide, onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }),
|
|
14156
|
-
/* @__PURE__ */
|
|
14157
|
-
/* @__PURE__ */
|
|
14318
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
|
|
14319
|
+
/* @__PURE__ */ jsxs11(
|
|
14158
14320
|
"div",
|
|
14159
14321
|
{
|
|
14160
14322
|
className: "delimiter-command-menu",
|
|
@@ -14178,7 +14340,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14178
14340
|
children: "()"
|
|
14179
14341
|
}
|
|
14180
14342
|
),
|
|
14181
|
-
/* @__PURE__ */
|
|
14343
|
+
/* @__PURE__ */ jsxs11("div", { className: "delimiter-command-options", role: "listbox", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
|
|
14182
14344
|
/* @__PURE__ */ jsx12(
|
|
14183
14345
|
"button",
|
|
14184
14346
|
{
|
|
@@ -14240,7 +14402,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14240
14402
|
/* @__PURE__ */ jsx12("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onClick: () => {
|
|
14241
14403
|
runtimeRef.current?.insertFraction();
|
|
14242
14404
|
focusSurface();
|
|
14243
|
-
}, children: /* @__PURE__ */
|
|
14405
|
+
}, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
|
|
14244
14406
|
/* @__PURE__ */ jsx12("span", { children: "\u0623" }),
|
|
14245
14407
|
/* @__PURE__ */ jsx12("span", { children: "\u0628" })
|
|
14246
14408
|
] }) }),
|
|
@@ -14251,26 +14413,26 @@ ${arabic || currentMessages.empty}`;
|
|
|
14251
14413
|
/* @__PURE__ */ jsx12("button", { id: "insert-overset", className: "icon-btn", type: "button", title: messages.insertOverset, "aria-label": messages.insertOverset, onClick: () => {
|
|
14252
14414
|
runtimeRef.current?.insertOverset();
|
|
14253
14415
|
focusSurface();
|
|
14254
|
-
}, children: /* @__PURE__ */
|
|
14416
|
+
}, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
|
|
14255
14417
|
/* @__PURE__ */ jsx12("span", { children: "\u2217" }),
|
|
14256
14418
|
/* @__PURE__ */ jsx12("span", { children: "\u25A1" })
|
|
14257
14419
|
] }) }),
|
|
14258
14420
|
/* @__PURE__ */ jsx12("button", { id: "insert-underset", className: "icon-btn", type: "button", title: messages.insertUnderset, "aria-label": messages.insertUnderset, onClick: () => {
|
|
14259
14421
|
runtimeRef.current?.insertUnderset();
|
|
14260
14422
|
focusSurface();
|
|
14261
|
-
}, children: /* @__PURE__ */
|
|
14423
|
+
}, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--under", "aria-hidden": "true", children: [
|
|
14262
14424
|
/* @__PURE__ */ jsx12("span", { children: "\u25A1" }),
|
|
14263
14425
|
/* @__PURE__ */ jsx12("span", { children: "\u2217" })
|
|
14264
14426
|
] }) }),
|
|
14265
14427
|
/* @__PURE__ */ jsx12("button", { id: "insert-accent-pair", className: "icon-btn", type: "button", title: messages.insertAccentPair, "aria-label": messages.insertAccentPair, onClick: () => {
|
|
14266
14428
|
runtimeRef.current?.insertAccentPair();
|
|
14267
14429
|
focusSurface();
|
|
14268
|
-
}, children: /* @__PURE__ */
|
|
14430
|
+
}, children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--pair", "aria-hidden": "true", children: [
|
|
14269
14431
|
/* @__PURE__ */ jsx12("span", { children: "\u2217" }),
|
|
14270
14432
|
/* @__PURE__ */ jsx12("span", { children: "\u25A1" }),
|
|
14271
14433
|
/* @__PURE__ */ jsx12("span", { children: "\u2217" })
|
|
14272
14434
|
] }) }),
|
|
14273
|
-
/* @__PURE__ */
|
|
14435
|
+
/* @__PURE__ */ jsxs11(
|
|
14274
14436
|
"div",
|
|
14275
14437
|
{
|
|
14276
14438
|
className: "function-command-menu operator-command-menu",
|
|
@@ -14292,7 +14454,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14292
14454
|
"aria-haspopup": "listbox",
|
|
14293
14455
|
"aria-expanded": accentMenuOpen,
|
|
14294
14456
|
onClick: () => setAccentMenuOpen((open) => !open),
|
|
14295
|
-
children: /* @__PURE__ */
|
|
14457
|
+
children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-accent-icon toolbar-accent-icon--over", "aria-hidden": "true", children: [
|
|
14296
14458
|
/* @__PURE__ */ jsx12("span", { children: "\u02C6" }),
|
|
14297
14459
|
/* @__PURE__ */ jsx12("span", { children: "\u25A1" })
|
|
14298
14460
|
] })
|
|
@@ -14320,7 +14482,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14320
14482
|
}
|
|
14321
14483
|
)
|
|
14322
14484
|
] }),
|
|
14323
|
-
/* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */
|
|
14485
|
+
/* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ jsxs11(
|
|
14324
14486
|
"div",
|
|
14325
14487
|
{
|
|
14326
14488
|
className: "matrix-command-menu",
|
|
@@ -14341,7 +14503,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14341
14503
|
"aria-haspopup": "dialog",
|
|
14342
14504
|
"aria-expanded": matrixMenuOpen,
|
|
14343
14505
|
onClick: () => setMatrixMenuOpen((open) => !open),
|
|
14344
|
-
children: /* @__PURE__ */
|
|
14506
|
+
children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-matrix-icon", "aria-hidden": "true", children: [
|
|
14345
14507
|
/* @__PURE__ */ jsx12("span", {}),
|
|
14346
14508
|
/* @__PURE__ */ jsx12("span", {}),
|
|
14347
14509
|
/* @__PURE__ */ jsx12("span", {}),
|
|
@@ -14349,7 +14511,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14349
14511
|
] })
|
|
14350
14512
|
}
|
|
14351
14513
|
),
|
|
14352
|
-
/* @__PURE__ */
|
|
14514
|
+
/* @__PURE__ */ jsxs11("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
|
|
14353
14515
|
/* @__PURE__ */ jsx12("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.environmentType, children: [
|
|
14354
14516
|
{ id: "matrix", label: messages.matrix },
|
|
14355
14517
|
{ id: "array", label: messages.array },
|
|
@@ -14418,8 +14580,8 @@ ${arabic || currentMessages.empty}`;
|
|
|
14418
14580
|
);
|
|
14419
14581
|
})
|
|
14420
14582
|
) }),
|
|
14421
|
-
/* @__PURE__ */
|
|
14422
|
-
/* @__PURE__ */
|
|
14583
|
+
/* @__PURE__ */ jsxs11("div", { className: "matrix-custom-size", children: [
|
|
14584
|
+
/* @__PURE__ */ jsxs11("label", { children: [
|
|
14423
14585
|
messages.row,
|
|
14424
14586
|
/* @__PURE__ */ jsx12(
|
|
14425
14587
|
"input",
|
|
@@ -14432,7 +14594,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14432
14594
|
}
|
|
14433
14595
|
)
|
|
14434
14596
|
] }),
|
|
14435
|
-
/* @__PURE__ */
|
|
14597
|
+
/* @__PURE__ */ jsxs11("label", { children: [
|
|
14436
14598
|
messages.column,
|
|
14437
14599
|
/* @__PURE__ */ jsx12(
|
|
14438
14600
|
"input",
|
|
@@ -14463,10 +14625,10 @@ ${arabic || currentMessages.empty}`;
|
|
|
14463
14625
|
}
|
|
14464
14626
|
)
|
|
14465
14627
|
] }),
|
|
14466
|
-
/* @__PURE__ */
|
|
14628
|
+
/* @__PURE__ */ jsxs11("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
|
|
14467
14629
|
envPaletteMode === "matrix" ? /* @__PURE__ */ jsx12("button", { type: "button", title: messages.applySelectedMatrixStyle, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
|
|
14468
|
-
envPaletteMode === "array" ? /* @__PURE__ */
|
|
14469
|
-
/* @__PURE__ */
|
|
14630
|
+
envPaletteMode === "array" ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
14631
|
+
/* @__PURE__ */ jsxs11("label", { children: [
|
|
14470
14632
|
messages.column,
|
|
14471
14633
|
/* @__PURE__ */ jsx12(
|
|
14472
14634
|
"input",
|
|
@@ -14491,19 +14653,19 @@ ${arabic || currentMessages.empty}`;
|
|
|
14491
14653
|
alignment.id
|
|
14492
14654
|
))
|
|
14493
14655
|
] }) : null,
|
|
14494
|
-
/* @__PURE__ */
|
|
14656
|
+
/* @__PURE__ */ jsxs11("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
|
|
14495
14657
|
"+",
|
|
14496
14658
|
messages.row
|
|
14497
14659
|
] }),
|
|
14498
|
-
/* @__PURE__ */
|
|
14660
|
+
/* @__PURE__ */ jsxs11("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
|
|
14499
14661
|
"-",
|
|
14500
14662
|
messages.row
|
|
14501
14663
|
] }),
|
|
14502
|
-
/* @__PURE__ */
|
|
14664
|
+
/* @__PURE__ */ jsxs11("button", { type: "button", title: messages.addColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
|
|
14503
14665
|
"+",
|
|
14504
14666
|
messages.column
|
|
14505
14667
|
] }),
|
|
14506
|
-
/* @__PURE__ */
|
|
14668
|
+
/* @__PURE__ */ jsxs11("button", { type: "button", title: messages.removeColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
|
|
14507
14669
|
"-",
|
|
14508
14670
|
messages.column
|
|
14509
14671
|
] })
|
|
@@ -14512,7 +14674,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14512
14674
|
]
|
|
14513
14675
|
}
|
|
14514
14676
|
) }),
|
|
14515
|
-
/* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */
|
|
14677
|
+
/* @__PURE__ */ jsx12("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ jsxs11(
|
|
14516
14678
|
"div",
|
|
14517
14679
|
{
|
|
14518
14680
|
className: `spacing-command-menu spacing-command-menu--${activeEditorSide}`,
|
|
@@ -14533,13 +14695,13 @@ ${arabic || currentMessages.empty}`;
|
|
|
14533
14695
|
"aria-haspopup": "listbox",
|
|
14534
14696
|
"aria-expanded": spacingMenuOpen,
|
|
14535
14697
|
onClick: () => setSpacingMenuOpen((open) => !open),
|
|
14536
|
-
children: /* @__PURE__ */
|
|
14698
|
+
children: /* @__PURE__ */ jsxs11("span", { className: "spacing-command-glyph spacing-command-glyph--positive spacing-command-glyph--level-2", "aria-hidden": "true", children: [
|
|
14537
14699
|
/* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__bar" }),
|
|
14538
14700
|
/* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__arrow", children: activeEditorSide === "arabic" ? "\u2190" : "\u2192" })
|
|
14539
14701
|
] })
|
|
14540
14702
|
}
|
|
14541
14703
|
),
|
|
14542
|
-
/* @__PURE__ */ jsx12("div", { className: "spacing-command-options", role: "listbox", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS.map((command) => /* @__PURE__ */
|
|
14704
|
+
/* @__PURE__ */ jsx12("div", { className: "spacing-command-options", role: "listbox", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ jsxs11(
|
|
14543
14705
|
"button",
|
|
14544
14706
|
{
|
|
14545
14707
|
type: "button",
|
|
@@ -14553,7 +14715,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14553
14715
|
focusSurface();
|
|
14554
14716
|
},
|
|
14555
14717
|
children: [
|
|
14556
|
-
/* @__PURE__ */
|
|
14718
|
+
/* @__PURE__ */ jsxs11("span", { className: `spacing-command-glyph spacing-command-glyph--${command.spacing.direction} spacing-command-glyph--level-${String(command.spacing.level)}`, "aria-hidden": "true", children: [
|
|
14557
14719
|
command.spacing.direction === "negative" ? /* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, activeEditorSide) }) : null,
|
|
14558
14720
|
/* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__bar" }),
|
|
14559
14721
|
command.spacing.direction === "positive" ? /* @__PURE__ */ jsx12("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, activeEditorSide) }) : null
|
|
@@ -14566,8 +14728,8 @@ ${arabic || currentMessages.empty}`;
|
|
|
14566
14728
|
]
|
|
14567
14729
|
}
|
|
14568
14730
|
) }),
|
|
14569
|
-
/* @__PURE__ */
|
|
14570
|
-
/* @__PURE__ */
|
|
14731
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
|
|
14732
|
+
/* @__PURE__ */ jsxs11(
|
|
14571
14733
|
"div",
|
|
14572
14734
|
{
|
|
14573
14735
|
className: "function-command-menu",
|
|
@@ -14612,7 +14774,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14612
14774
|
]
|
|
14613
14775
|
}
|
|
14614
14776
|
),
|
|
14615
|
-
/* @__PURE__ */
|
|
14777
|
+
/* @__PURE__ */ jsxs11(
|
|
14616
14778
|
"div",
|
|
14617
14779
|
{
|
|
14618
14780
|
className: "function-command-menu function-command-menu--limits-series",
|
|
@@ -14657,7 +14819,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14657
14819
|
]
|
|
14658
14820
|
}
|
|
14659
14821
|
),
|
|
14660
|
-
/* @__PURE__ */
|
|
14822
|
+
/* @__PURE__ */ jsxs11(
|
|
14661
14823
|
"div",
|
|
14662
14824
|
{
|
|
14663
14825
|
className: "function-command-menu function-command-menu--function2",
|
|
@@ -14702,7 +14864,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14702
14864
|
]
|
|
14703
14865
|
}
|
|
14704
14866
|
),
|
|
14705
|
-
/* @__PURE__ */
|
|
14867
|
+
/* @__PURE__ */ jsxs11(
|
|
14706
14868
|
"div",
|
|
14707
14869
|
{
|
|
14708
14870
|
className: "function-command-menu function-command-menu--derivative",
|
|
@@ -14726,7 +14888,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14726
14888
|
children: DERIVATIVE_COMMANDS[0]?.arabicLabel ?? "\u0621"
|
|
14727
14889
|
}
|
|
14728
14890
|
),
|
|
14729
|
-
/* @__PURE__ */
|
|
14891
|
+
/* @__PURE__ */ jsxs11("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertDerivative, hidden: !derivativeMenuOpen, children: [
|
|
14730
14892
|
DERIVATIVE_COMMANDS.map((command) => /* @__PURE__ */ jsx12(
|
|
14731
14893
|
"button",
|
|
14732
14894
|
{
|
|
@@ -14783,7 +14945,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14783
14945
|
]
|
|
14784
14946
|
}
|
|
14785
14947
|
),
|
|
14786
|
-
/* @__PURE__ */
|
|
14948
|
+
/* @__PURE__ */ jsxs11(
|
|
14787
14949
|
"div",
|
|
14788
14950
|
{
|
|
14789
14951
|
className: "function-command-menu function-command-menu--groups",
|
|
@@ -14829,8 +14991,8 @@ ${arabic || currentMessages.empty}`;
|
|
|
14829
14991
|
}
|
|
14830
14992
|
)
|
|
14831
14993
|
] }),
|
|
14832
|
-
/* @__PURE__ */
|
|
14833
|
-
/* @__PURE__ */
|
|
14994
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
|
|
14995
|
+
/* @__PURE__ */ jsxs11(
|
|
14834
14996
|
"div",
|
|
14835
14997
|
{
|
|
14836
14998
|
className: "function-command-menu operator-command-menu",
|
|
@@ -14875,7 +15037,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14875
15037
|
]
|
|
14876
15038
|
}
|
|
14877
15039
|
),
|
|
14878
|
-
/* @__PURE__ */
|
|
15040
|
+
/* @__PURE__ */ jsxs11(
|
|
14879
15041
|
"div",
|
|
14880
15042
|
{
|
|
14881
15043
|
className: "function-command-menu operator-command-menu",
|
|
@@ -14920,7 +15082,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14920
15082
|
]
|
|
14921
15083
|
}
|
|
14922
15084
|
),
|
|
14923
|
-
/* @__PURE__ */
|
|
15085
|
+
/* @__PURE__ */ jsxs11(
|
|
14924
15086
|
"div",
|
|
14925
15087
|
{
|
|
14926
15088
|
className: "function-command-menu operator-command-menu",
|
|
@@ -14965,7 +15127,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
14965
15127
|
]
|
|
14966
15128
|
}
|
|
14967
15129
|
),
|
|
14968
|
-
/* @__PURE__ */
|
|
15130
|
+
/* @__PURE__ */ jsxs11(
|
|
14969
15131
|
"div",
|
|
14970
15132
|
{
|
|
14971
15133
|
className: "function-command-menu operator-command-menu",
|
|
@@ -15010,7 +15172,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
15010
15172
|
]
|
|
15011
15173
|
}
|
|
15012
15174
|
),
|
|
15013
|
-
/* @__PURE__ */
|
|
15175
|
+
/* @__PURE__ */ jsxs11(
|
|
15014
15176
|
"div",
|
|
15015
15177
|
{
|
|
15016
15178
|
className: "function-command-menu operator-command-menu",
|
|
@@ -15056,28 +15218,28 @@ ${arabic || currentMessages.empty}`;
|
|
|
15056
15218
|
}
|
|
15057
15219
|
)
|
|
15058
15220
|
] }),
|
|
15059
|
-
/* @__PURE__ */
|
|
15060
|
-
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */
|
|
15221
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
|
|
15222
|
+
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
|
|
15061
15223
|
/* @__PURE__ */ jsx12("span", { children: "\u0646" }),
|
|
15062
15224
|
/* @__PURE__ */ jsx12("span", { children: "\u0633" })
|
|
15063
15225
|
] }) }),
|
|
15064
|
-
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */
|
|
15226
|
+
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
|
|
15065
15227
|
/* @__PURE__ */ jsx12("span", { children: "\u0646" }),
|
|
15066
15228
|
/* @__PURE__ */ jsx12("span", { children: "\u0633" })
|
|
15067
15229
|
] }) }),
|
|
15068
|
-
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runtimeRef.current?.removeSup(), children: /* @__PURE__ */
|
|
15230
|
+
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSuperscript, "aria-label": messages.removeSuperscript, onClick: () => runtimeRef.current?.removeSup(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
|
|
15069
15231
|
/* @__PURE__ */ jsx12("span", { children: "\u0646" }),
|
|
15070
15232
|
/* @__PURE__ */ jsx12("span", { children: "\xD7" })
|
|
15071
15233
|
] }) }),
|
|
15072
|
-
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runtimeRef.current?.removeSub(), children: /* @__PURE__ */
|
|
15234
|
+
/* @__PURE__ */ jsx12("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title: messages.removeSubscript, "aria-label": messages.removeSubscript, onClick: () => runtimeRef.current?.removeSub(), children: /* @__PURE__ */ jsxs11("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
|
|
15073
15235
|
/* @__PURE__ */ jsx12("span", { children: "\u0646" }),
|
|
15074
15236
|
/* @__PURE__ */ jsx12("span", { children: "\xD7" })
|
|
15075
15237
|
] }) })
|
|
15076
15238
|
] }),
|
|
15077
|
-
/* @__PURE__ */
|
|
15239
|
+
/* @__PURE__ */ jsxs11("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
|
|
15078
15240
|
/* @__PURE__ */ jsx12("button", { className: "icon-btn delete-node-btn", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
|
|
15079
15241
|
/* @__PURE__ */ jsx12("button", { ref: splitTypingBtnRef, id: "toggle-split-leaf-typing", className: "icon-btn ligature-btn", type: "button", title: messages.toggleLetterMerging, "aria-label": messages.toggleLetterMerging, onClick: () => runtimeRef.current?.toggleSplitLeafTyping(), children: "\u0633\u0635\u0639" }),
|
|
15080
|
-
/* @__PURE__ */
|
|
15242
|
+
/* @__PURE__ */ jsxs11(
|
|
15081
15243
|
"div",
|
|
15082
15244
|
{
|
|
15083
15245
|
className: "character-font-menu",
|
|
@@ -15125,7 +15287,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
15125
15287
|
]
|
|
15126
15288
|
}
|
|
15127
15289
|
),
|
|
15128
|
-
/* @__PURE__ */
|
|
15290
|
+
/* @__PURE__ */ jsxs11(
|
|
15129
15291
|
"div",
|
|
15130
15292
|
{
|
|
15131
15293
|
className: "digit-form-menu",
|
|
@@ -15202,14 +15364,14 @@ ${arabic || currentMessages.empty}`;
|
|
|
15202
15364
|
/* @__PURE__ */ jsx12("div", { ref: renderErrorRef, className: "error", hidden: true })
|
|
15203
15365
|
] }),
|
|
15204
15366
|
/* @__PURE__ */ jsx12("section", { className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx12("div", { ref: mathOutputRef, className: "preview-box" }) }),
|
|
15205
|
-
debugEnabled ? /* @__PURE__ */
|
|
15206
|
-
/* @__PURE__ */
|
|
15367
|
+
debugEnabled ? /* @__PURE__ */ jsxs11("section", { className: "panel", children: [
|
|
15368
|
+
/* @__PURE__ */ jsxs11("div", { className: "dev-strip", children: [
|
|
15207
15369
|
/* @__PURE__ */ jsx12("span", { className: "dev-badge", children: messages.development }),
|
|
15208
15370
|
/* @__PURE__ */ jsx12("div", { ref: latexLinesRef, className: "ascii" }),
|
|
15209
15371
|
/* @__PURE__ */ jsx12("div", { ref: passivePreviewRef, className: "passive-preview-text" })
|
|
15210
15372
|
] }),
|
|
15211
|
-
/* @__PURE__ */
|
|
15212
|
-
/* @__PURE__ */
|
|
15373
|
+
/* @__PURE__ */ jsxs11("div", { style: { marginTop: 12 }, children: [
|
|
15374
|
+
/* @__PURE__ */ jsxs11("div", { className: "debug-head", children: [
|
|
15213
15375
|
/* @__PURE__ */ jsx12("button", { type: "button", onClick: () => void copyDebugText(currentMathObjectJsonText()), children: "Copy MathObject JSON" }),
|
|
15214
15376
|
/* @__PURE__ */ jsx12("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugMathObjectImport, children: "Import MathObject JSON" }),
|
|
15215
15377
|
/* @__PURE__ */ jsx12(
|
|
@@ -15247,7 +15409,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
15247
15409
|
}
|
|
15248
15410
|
)
|
|
15249
15411
|
] }),
|
|
15250
|
-
debugImportOpen ? /* @__PURE__ */
|
|
15412
|
+
debugImportOpen ? /* @__PURE__ */ jsxs11("div", { className: "debug-json-import", children: [
|
|
15251
15413
|
/* @__PURE__ */ jsx12(
|
|
15252
15414
|
"textarea",
|
|
15253
15415
|
{
|
|
@@ -15260,7 +15422,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
15260
15422
|
}
|
|
15261
15423
|
}
|
|
15262
15424
|
),
|
|
15263
|
-
/* @__PURE__ */
|
|
15425
|
+
/* @__PURE__ */ jsxs11("div", { className: "debug-head", children: [
|
|
15264
15426
|
/* @__PURE__ */ jsx12("button", { type: "button", onClick: applyDebugMathObjectImport, children: "Apply" }),
|
|
15265
15427
|
/* @__PURE__ */ jsx12(
|
|
15266
15428
|
"button",
|
|
@@ -15287,7 +15449,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
15287
15449
|
ButexEditor.displayName = "ButexEditor";
|
|
15288
15450
|
|
|
15289
15451
|
// src/react-document2/EquationDrawer.tsx
|
|
15290
|
-
import { jsx as jsx13, jsxs as
|
|
15452
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
15291
15453
|
function keyErrorMessage2(error, messages) {
|
|
15292
15454
|
if (error === "empty") {
|
|
15293
15455
|
return messages.keyEmpty;
|
|
@@ -15341,7 +15503,7 @@ function EquationDrawer({
|
|
|
15341
15503
|
window.addEventListener("keydown", onKeyDown);
|
|
15342
15504
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
15343
15505
|
}, [onClose]);
|
|
15344
|
-
return /* @__PURE__ */
|
|
15506
|
+
return /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__equation-modal", role: "presentation", children: [
|
|
15345
15507
|
/* @__PURE__ */ jsx13(
|
|
15346
15508
|
"button",
|
|
15347
15509
|
{
|
|
@@ -15351,7 +15513,7 @@ function EquationDrawer({
|
|
|
15351
15513
|
onClick: onClose
|
|
15352
15514
|
}
|
|
15353
15515
|
),
|
|
15354
|
-
/* @__PURE__ */
|
|
15516
|
+
/* @__PURE__ */ jsxs12(
|
|
15355
15517
|
"div",
|
|
15356
15518
|
{
|
|
15357
15519
|
className: "butex-document2-widget__equation-modal-panel",
|
|
@@ -15361,22 +15523,22 @@ function EquationDrawer({
|
|
|
15361
15523
|
dir: uiLocaleDirection(uiLocale),
|
|
15362
15524
|
lang: uiLocale,
|
|
15363
15525
|
children: [
|
|
15364
|
-
/* @__PURE__ */
|
|
15526
|
+
/* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__row", children: [
|
|
15365
15527
|
/* @__PURE__ */ jsx13("strong", { id: "butex-document2-equation-modal-title", children: messages.equationEditorTitle }),
|
|
15366
15528
|
/* @__PURE__ */ jsx13("button", { type: "button", onClick: onClose, children: messages.close })
|
|
15367
15529
|
] }),
|
|
15368
|
-
/* @__PURE__ */
|
|
15369
|
-
/* @__PURE__ */
|
|
15530
|
+
/* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__row", role: "group", "aria-label": messages.equationType, children: [
|
|
15531
|
+
/* @__PURE__ */ jsxs12("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: [
|
|
15370
15532
|
messages.inline,
|
|
15371
15533
|
" ($)"
|
|
15372
15534
|
] }),
|
|
15373
|
-
/* @__PURE__ */
|
|
15535
|
+
/* @__PURE__ */ jsxs12("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: [
|
|
15374
15536
|
messages.displayed,
|
|
15375
15537
|
" (\\\\[)"
|
|
15376
15538
|
] })
|
|
15377
15539
|
] }),
|
|
15378
|
-
mathMode === "display" ? /* @__PURE__ */
|
|
15379
|
-
/* @__PURE__ */
|
|
15540
|
+
mathMode === "display" ? /* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__float-meta", children: [
|
|
15541
|
+
/* @__PURE__ */ jsxs12("label", { className: "butex-document2-widget__float-meta-toggle", children: [
|
|
15380
15542
|
/* @__PURE__ */ jsx13(
|
|
15381
15543
|
"input",
|
|
15382
15544
|
{
|
|
@@ -15387,7 +15549,7 @@ function EquationDrawer({
|
|
|
15387
15549
|
),
|
|
15388
15550
|
/* @__PURE__ */ jsx13("span", { children: messages.labelToggle })
|
|
15389
15551
|
] }),
|
|
15390
|
-
labelEnabled ? /* @__PURE__ */
|
|
15552
|
+
labelEnabled ? /* @__PURE__ */ jsxs12("label", { className: "butex-document2-widget__refs-field", children: [
|
|
15391
15553
|
/* @__PURE__ */ jsx13("span", { children: messages.floatLabel }),
|
|
15392
15554
|
/* @__PURE__ */ jsx13(
|
|
15393
15555
|
"input",
|
|
@@ -15428,7 +15590,7 @@ function EquationDrawer({
|
|
|
15428
15590
|
}
|
|
15429
15591
|
}
|
|
15430
15592
|
),
|
|
15431
|
-
/* @__PURE__ */
|
|
15593
|
+
/* @__PURE__ */ jsxs12("div", { className: "butex-document2-widget__row", children: [
|
|
15432
15594
|
canDelete && onDelete ? /* @__PURE__ */ jsx13("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: onDelete, children: messages.deleteEquation }) : null,
|
|
15433
15595
|
/* @__PURE__ */ jsx13(
|
|
15434
15596
|
"button",
|
|
@@ -15448,7 +15610,7 @@ function EquationDrawer({
|
|
|
15448
15610
|
|
|
15449
15611
|
// src/react-document2/LabelsPanel.tsx
|
|
15450
15612
|
import { useState as useState9 } from "react";
|
|
15451
|
-
import { jsx as jsx14, jsxs as
|
|
15613
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
15452
15614
|
function keyErrorMessage3(error, messages) {
|
|
15453
15615
|
if (error === "empty") {
|
|
15454
15616
|
return messages.keyEmpty;
|
|
@@ -15477,7 +15639,7 @@ function LabelsPanel({
|
|
|
15477
15639
|
if (!open) {
|
|
15478
15640
|
return null;
|
|
15479
15641
|
}
|
|
15480
|
-
return /* @__PURE__ */ jsx14("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */
|
|
15642
|
+
return /* @__PURE__ */ jsx14("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs13(
|
|
15481
15643
|
"div",
|
|
15482
15644
|
{
|
|
15483
15645
|
className: "butex-document2-widget__refs-panel",
|
|
@@ -15485,7 +15647,7 @@ function LabelsPanel({
|
|
|
15485
15647
|
"aria-label": messages.labelsTitle,
|
|
15486
15648
|
onClick: (event) => event.stopPropagation(),
|
|
15487
15649
|
children: [
|
|
15488
|
-
/* @__PURE__ */
|
|
15650
|
+
/* @__PURE__ */ jsxs13("header", { className: "butex-document2-widget__refs-header", children: [
|
|
15489
15651
|
/* @__PURE__ */ jsx14("strong", { children: messages.labelsTitle }),
|
|
15490
15652
|
/* @__PURE__ */ jsx14("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
|
|
15491
15653
|
] }),
|
|
@@ -15504,8 +15666,8 @@ function LabelsPanel({
|
|
|
15504
15666
|
labels,
|
|
15505
15667
|
excludeOwnerId: entry.ownerId
|
|
15506
15668
|
});
|
|
15507
|
-
return /* @__PURE__ */
|
|
15508
|
-
/* @__PURE__ */
|
|
15669
|
+
return /* @__PURE__ */ jsxs13("li", { className: "butex-document2-widget__refs-item", children: [
|
|
15670
|
+
/* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-item-head", children: [
|
|
15509
15671
|
/* @__PURE__ */ jsx14("strong", { children: title }),
|
|
15510
15672
|
/* @__PURE__ */ jsx14("span", { className: "butex-document2-widget__refs-item-key", children: entry.key })
|
|
15511
15673
|
] }),
|
|
@@ -15518,8 +15680,8 @@ function LabelsPanel({
|
|
|
15518
15680
|
children: captionPreview
|
|
15519
15681
|
}
|
|
15520
15682
|
),
|
|
15521
|
-
/* @__PURE__ */
|
|
15522
|
-
/* @__PURE__ */
|
|
15683
|
+
/* @__PURE__ */ jsxs13("div", { className: "butex-document2-widget__refs-grid", children: [
|
|
15684
|
+
/* @__PURE__ */ jsxs13("label", { className: "butex-document2-widget__refs-field", children: [
|
|
15523
15685
|
/* @__PURE__ */ jsx14("span", { children: messages.floatLabel }),
|
|
15524
15686
|
/* @__PURE__ */ jsx14(
|
|
15525
15687
|
"input",
|
|
@@ -15553,7 +15715,7 @@ function LabelsPanel({
|
|
|
15553
15715
|
),
|
|
15554
15716
|
entryKeyError !== null ? /* @__PURE__ */ jsx14("p", { className: "butex-document2-widget__field-error", children: entryKeyError === "invalid" ? messages.keyRulesHint : keyErrorMessage3(entryKeyError, messages) }) : null
|
|
15555
15717
|
] }),
|
|
15556
|
-
entry.kind === "fig" || entry.kind === "tab" ? /* @__PURE__ */
|
|
15718
|
+
entry.kind === "fig" || entry.kind === "tab" ? /* @__PURE__ */ jsxs13("label", { className: "butex-document2-widget__refs-field", children: [
|
|
15557
15719
|
/* @__PURE__ */ jsx14("span", { children: messages.floatCaption }),
|
|
15558
15720
|
/* @__PURE__ */ jsx14(
|
|
15559
15721
|
"input",
|
|
@@ -15579,7 +15741,7 @@ function LabelsPanel({
|
|
|
15579
15741
|
|
|
15580
15742
|
// src/react-document2/ReferencesPanel.tsx
|
|
15581
15743
|
import { useMemo, useState as useState10 } from "react";
|
|
15582
|
-
import { Fragment as
|
|
15744
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
15583
15745
|
var EMPTY_DRAFT = {
|
|
15584
15746
|
key: "",
|
|
15585
15747
|
authors: "",
|
|
@@ -15614,9 +15776,9 @@ function FieldSeparatorToggle({
|
|
|
15614
15776
|
messages,
|
|
15615
15777
|
onChange
|
|
15616
15778
|
}) {
|
|
15617
|
-
return /* @__PURE__ */
|
|
15779
|
+
return /* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-field butex-document2-widget__refs-separator", children: [
|
|
15618
15780
|
/* @__PURE__ */ jsx15("span", { children: messages.referenceFieldSeparator }),
|
|
15619
|
-
/* @__PURE__ */
|
|
15781
|
+
/* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-separator-toggle", role: "group", "aria-label": messages.referenceFieldSeparator, children: [
|
|
15620
15782
|
/* @__PURE__ */ jsx15(
|
|
15621
15783
|
"button",
|
|
15622
15784
|
{
|
|
@@ -15657,20 +15819,20 @@ function ReferencePreview({
|
|
|
15657
15819
|
digitForm
|
|
15658
15820
|
}) {
|
|
15659
15821
|
const body = bibliographyEntryBody({ authors, title, venue, year, fieldSeparator }, fieldSeparator, { digitForm });
|
|
15660
|
-
return /* @__PURE__ */
|
|
15822
|
+
return /* @__PURE__ */ jsxs14(
|
|
15661
15823
|
"div",
|
|
15662
15824
|
{
|
|
15663
15825
|
className: "butex-document2-widget__modal-preview",
|
|
15664
15826
|
dir: uiLocaleDirection(uiLocale),
|
|
15665
15827
|
"aria-label": messages.referencePreview,
|
|
15666
15828
|
children: [
|
|
15667
|
-
numberLabel ? /* @__PURE__ */
|
|
15829
|
+
numberLabel ? /* @__PURE__ */ jsxs14("span", { className: "butex-document2-widget__modal-preview-number", children: [
|
|
15668
15830
|
"[",
|
|
15669
15831
|
numberLabel,
|
|
15670
15832
|
"] "
|
|
15671
15833
|
] }) : null,
|
|
15672
15834
|
body.length > 0 ? body : /* @__PURE__ */ jsx15("span", { className: "butex-document2-widget__cite-picker-empty", children: "\u2026" }),
|
|
15673
|
-
url.trim().length > 0 ? /* @__PURE__ */
|
|
15835
|
+
url.trim().length > 0 ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
15674
15836
|
" ",
|
|
15675
15837
|
/* @__PURE__ */ jsx15("span", { className: "butex-document2-widget__modal-preview-url", children: url.trim() })
|
|
15676
15838
|
] }) : null
|
|
@@ -15706,7 +15868,7 @@ function ReferencesPanel({
|
|
|
15706
15868
|
if (!open) {
|
|
15707
15869
|
return null;
|
|
15708
15870
|
}
|
|
15709
|
-
return /* @__PURE__ */ jsx15("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */
|
|
15871
|
+
return /* @__PURE__ */ jsx15("div", { className: "butex-document2-widget__refs-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs14(
|
|
15710
15872
|
"div",
|
|
15711
15873
|
{
|
|
15712
15874
|
className: "butex-document2-widget__refs-panel",
|
|
@@ -15714,14 +15876,14 @@ function ReferencesPanel({
|
|
|
15714
15876
|
"aria-label": messages.referencesTitle,
|
|
15715
15877
|
onClick: (event) => event.stopPropagation(),
|
|
15716
15878
|
children: [
|
|
15717
|
-
/* @__PURE__ */
|
|
15879
|
+
/* @__PURE__ */ jsxs14("header", { className: "butex-document2-widget__refs-header", children: [
|
|
15718
15880
|
/* @__PURE__ */ jsx15("strong", { children: messages.referencesTitle }),
|
|
15719
15881
|
/* @__PURE__ */ jsx15("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
|
|
15720
15882
|
] }),
|
|
15721
|
-
/* @__PURE__ */
|
|
15883
|
+
/* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-add", children: [
|
|
15722
15884
|
/* @__PURE__ */ jsx15("h3", { children: messages.addReference }),
|
|
15723
|
-
/* @__PURE__ */
|
|
15724
|
-
REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */
|
|
15885
|
+
/* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-grid", children: [
|
|
15886
|
+
REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs14("label", { className: "butex-document2-widget__refs-field", children: [
|
|
15725
15887
|
/* @__PURE__ */ jsx15("span", { children: messages[messageKey] }),
|
|
15726
15888
|
/* @__PURE__ */ jsx15(
|
|
15727
15889
|
"input",
|
|
@@ -15785,15 +15947,15 @@ function ReferencesPanel({
|
|
|
15785
15947
|
excludeReferenceId: reference.id
|
|
15786
15948
|
});
|
|
15787
15949
|
const numberLabel = formatBibliographyNumber(index + 1, { documentDirection, digitForm });
|
|
15788
|
-
return /* @__PURE__ */
|
|
15789
|
-
/* @__PURE__ */
|
|
15790
|
-
/* @__PURE__ */
|
|
15950
|
+
return /* @__PURE__ */ jsxs14("li", { className: "butex-document2-widget__refs-item", children: [
|
|
15951
|
+
/* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-item-head", children: [
|
|
15952
|
+
/* @__PURE__ */ jsxs14("strong", { children: [
|
|
15791
15953
|
"[",
|
|
15792
15954
|
numberLabel,
|
|
15793
15955
|
"] ",
|
|
15794
15956
|
reference.key
|
|
15795
15957
|
] }),
|
|
15796
|
-
/* @__PURE__ */
|
|
15958
|
+
/* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-item-actions", children: [
|
|
15797
15959
|
/* @__PURE__ */ jsx15("button", { type: "button", title: messages.moveUp, "aria-label": messages.moveUp, disabled: index === 0, onClick: () => onMove(reference.id, -1), children: "\u2191" }),
|
|
15798
15960
|
/* @__PURE__ */ jsx15(
|
|
15799
15961
|
"button",
|
|
@@ -15824,8 +15986,8 @@ function ReferencesPanel({
|
|
|
15824
15986
|
digitForm
|
|
15825
15987
|
}
|
|
15826
15988
|
),
|
|
15827
|
-
/* @__PURE__ */
|
|
15828
|
-
REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */
|
|
15989
|
+
/* @__PURE__ */ jsxs14("div", { className: "butex-document2-widget__refs-grid", children: [
|
|
15990
|
+
REFERENCE_FIELDS.map(([field, messageKey]) => /* @__PURE__ */ jsxs14("label", { className: "butex-document2-widget__refs-field", children: [
|
|
15829
15991
|
/* @__PURE__ */ jsx15("span", { children: messages[messageKey] }),
|
|
15830
15992
|
/* @__PURE__ */ jsx15(
|
|
15831
15993
|
"input",
|
|
@@ -15875,7 +16037,7 @@ function ReferencesPanel({
|
|
|
15875
16037
|
|
|
15876
16038
|
// src/react-document2/RefPickerPopover.tsx
|
|
15877
16039
|
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
15878
|
-
import { jsx as jsx16, jsxs as
|
|
16040
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
15879
16041
|
function RefPickerPopover({
|
|
15880
16042
|
open,
|
|
15881
16043
|
labels,
|
|
@@ -15904,7 +16066,7 @@ function RefPickerPopover({
|
|
|
15904
16066
|
setSelected([key]);
|
|
15905
16067
|
setRefCommand(kind === "eq" ? "eqref" : "ref");
|
|
15906
16068
|
}
|
|
15907
|
-
return /* @__PURE__ */ jsx16("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */
|
|
16069
|
+
return /* @__PURE__ */ jsx16("div", { className: "butex-document2-widget__cite-picker-backdrop", role: "presentation", onClick: onClose, children: /* @__PURE__ */ jsxs15(
|
|
15908
16070
|
"div",
|
|
15909
16071
|
{
|
|
15910
16072
|
className: "butex-document2-widget__cite-picker",
|
|
@@ -15912,7 +16074,7 @@ function RefPickerPopover({
|
|
|
15912
16074
|
"aria-label": messages.refPickerTitle,
|
|
15913
16075
|
onClick: (event) => event.stopPropagation(),
|
|
15914
16076
|
children: [
|
|
15915
|
-
/* @__PURE__ */
|
|
16077
|
+
/* @__PURE__ */ jsxs15("header", { className: "butex-document2-widget__cite-picker-header", children: [
|
|
15916
16078
|
/* @__PURE__ */ jsx16("strong", { children: messages.refPickerTitle }),
|
|
15917
16079
|
/* @__PURE__ */ jsx16("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.close, "aria-label": messages.close, onClick: onClose, children: "\xD7" })
|
|
15918
16080
|
] }),
|
|
@@ -15923,10 +16085,10 @@ function RefPickerPopover({
|
|
|
15923
16085
|
digitForm,
|
|
15924
16086
|
documentDirection
|
|
15925
16087
|
});
|
|
15926
|
-
return /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */
|
|
16088
|
+
return /* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsxs15("label", { className: "butex-document2-widget__cite-picker-item", children: [
|
|
15927
16089
|
/* @__PURE__ */ jsx16("input", { type: "radio", name: "butex-ref-key", checked, onChange: () => selectKey(entry.key, entry.kind) }),
|
|
15928
|
-
/* @__PURE__ */
|
|
15929
|
-
/* @__PURE__ */
|
|
16090
|
+
/* @__PURE__ */ jsxs15("span", { children: [
|
|
16091
|
+
/* @__PURE__ */ jsxs15("strong", { children: [
|
|
15930
16092
|
title,
|
|
15931
16093
|
" ",
|
|
15932
16094
|
/* @__PURE__ */ jsx16("span", { className: "butex-document2-widget__refs-item-key", children: entry.key })
|
|
@@ -15935,7 +16097,7 @@ function RefPickerPopover({
|
|
|
15935
16097
|
] })
|
|
15936
16098
|
] }) }, `${entry.kind}:${entry.ownerId}`);
|
|
15937
16099
|
}) }),
|
|
15938
|
-
/* @__PURE__ */
|
|
16100
|
+
/* @__PURE__ */ jsxs15("footer", { className: "butex-document2-widget__cite-picker-footer", children: [
|
|
15939
16101
|
onManageLabels ? /* @__PURE__ */ jsx16("button", { type: "button", onClick: onManageLabels, children: messages.manageLabels }) : null,
|
|
15940
16102
|
/* @__PURE__ */ jsx16("button", { type: "button", onClick: onClose, children: messages.close }),
|
|
15941
16103
|
/* @__PURE__ */ jsx16(
|
|
@@ -17701,7 +17863,7 @@ function injectBuTeXDocument2Styles(doc) {
|
|
|
17701
17863
|
}
|
|
17702
17864
|
|
|
17703
17865
|
// src/react-document2/ButexDocumentEditor2.tsx
|
|
17704
|
-
import { Fragment as
|
|
17866
|
+
import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
17705
17867
|
function mathDelimiters(mode) {
|
|
17706
17868
|
return mode === "inline" ? { opening: "$", closing: "$" } : { opening: "\\[", closing: "\\]" };
|
|
17707
17869
|
}
|
|
@@ -18608,8 +18770,8 @@ var ButexDocumentEditor2 = forwardRef2(
|
|
|
18608
18770
|
className: ["butex-document2-widget", className].filter(Boolean).join(" "),
|
|
18609
18771
|
dir: uiLocaleDirection(uiLocale),
|
|
18610
18772
|
lang: uiLocale,
|
|
18611
|
-
children: /* @__PURE__ */
|
|
18612
|
-
!previewOnly ? /* @__PURE__ */
|
|
18773
|
+
children: /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__shell", children: [
|
|
18774
|
+
!previewOnly ? /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__toolbar", children: [
|
|
18613
18775
|
/* @__PURE__ */ jsx17(
|
|
18614
18776
|
DocumentInsertToolbar,
|
|
18615
18777
|
{
|
|
@@ -18675,17 +18837,17 @@ var ButexDocumentEditor2 = forwardRef2(
|
|
|
18675
18837
|
}
|
|
18676
18838
|
}
|
|
18677
18839
|
),
|
|
18678
|
-
/* @__PURE__ */
|
|
18840
|
+
/* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.panels, children: [
|
|
18679
18841
|
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? messages.hideEditor : messages.editor }),
|
|
18680
18842
|
/* @__PURE__ */ jsx17("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? messages.hidePreview : messages.preview })
|
|
18681
18843
|
] }),
|
|
18682
|
-
/* @__PURE__ */
|
|
18844
|
+
/* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.collapseBlocks, children: [
|
|
18683
18845
|
/* @__PURE__ */ jsx17("button", { type: "button", onClick: collapseAllBlocks, children: messages.collapseAll }),
|
|
18684
18846
|
/* @__PURE__ */ jsx17("button", { type: "button", onClick: openAllBlocks, children: messages.openAll })
|
|
18685
18847
|
] })
|
|
18686
18848
|
] }) : null,
|
|
18687
18849
|
error ? /* @__PURE__ */ jsx17("p", { className: "butex-document2-widget__error", children: error }) : null,
|
|
18688
|
-
/* @__PURE__ */
|
|
18850
|
+
/* @__PURE__ */ jsxs16(
|
|
18689
18851
|
"div",
|
|
18690
18852
|
{
|
|
18691
18853
|
className: `butex-document2-widget__layout butex-document2-widget__layout--editor-${showEditorPanel ? "open" : "closed"} butex-document2-widget__layout--preview-${showPreviewPanel ? "open" : "closed"}`,
|
|
@@ -18696,7 +18858,7 @@ var ButexDocumentEditor2 = forwardRef2(
|
|
|
18696
18858
|
className: "butex-document2-widget__panel butex-document2-widget__editor-panel",
|
|
18697
18859
|
"aria-label": messages.documentEditor,
|
|
18698
18860
|
"aria-hidden": !showEditorPanel,
|
|
18699
|
-
children: /* @__PURE__ */
|
|
18861
|
+
children: /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__blocks", children: [
|
|
18700
18862
|
/* @__PURE__ */ jsx17(
|
|
18701
18863
|
ArticleMetaPanel,
|
|
18702
18864
|
{
|
|
@@ -18805,17 +18967,17 @@ var ButexDocumentEditor2 = forwardRef2(
|
|
|
18805
18967
|
]
|
|
18806
18968
|
}
|
|
18807
18969
|
),
|
|
18808
|
-
debugEnabled ? /* @__PURE__ */
|
|
18809
|
-
debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */
|
|
18970
|
+
debugEnabled ? /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev", children: [
|
|
18971
|
+
debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
|
18810
18972
|
/* @__PURE__ */ jsx17("strong", { children: messages.importWarnings }),
|
|
18811
18973
|
documentNode.diagnostics.map((diagnostic) => /* @__PURE__ */ jsx17("p", { className: "butex-document2-widget__dev-diagnostic", children: formatDocument2Diagnostic(diagnostic, messages) }, `${diagnostic.path}-${diagnostic.message}`))
|
|
18812
18974
|
] }) : null,
|
|
18813
|
-
/* @__PURE__ */
|
|
18975
|
+
/* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev-actions", children: [
|
|
18814
18976
|
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => void copyDebugText(JSON.stringify(documentJson, null, 2)), children: "Copy JSON" }),
|
|
18815
18977
|
/* @__PURE__ */ jsx17("button", { type: "button", onClick: () => void copyDebugText(latex), children: "Copy TeX" }),
|
|
18816
18978
|
/* @__PURE__ */ jsx17("button", { type: "button", "aria-expanded": debugImportOpen, onClick: openDebugJsonImport, children: "Import JSON" })
|
|
18817
18979
|
] }),
|
|
18818
|
-
debugImportOpen ? /* @__PURE__ */
|
|
18980
|
+
debugImportOpen ? /* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev-import", children: [
|
|
18819
18981
|
/* @__PURE__ */ jsx17(
|
|
18820
18982
|
"textarea",
|
|
18821
18983
|
{
|
|
@@ -18828,7 +18990,7 @@ var ButexDocumentEditor2 = forwardRef2(
|
|
|
18828
18990
|
}
|
|
18829
18991
|
}
|
|
18830
18992
|
),
|
|
18831
|
-
/* @__PURE__ */
|
|
18993
|
+
/* @__PURE__ */ jsxs16("div", { className: "butex-document2-widget__dev-actions", children: [
|
|
18832
18994
|
/* @__PURE__ */ jsx17("button", { type: "button", onClick: applyDebugJsonImport, children: "Apply" }),
|
|
18833
18995
|
/* @__PURE__ */ jsx17(
|
|
18834
18996
|
"button",
|