@drghaliasri/butex 3.2.2 → 4.0.1
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/document.js +72 -0
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +72 -0
- package/dist/document.mjs.map +1 -1
- package/dist/document2.d.mts +11 -5
- package/dist/document2.d.ts +11 -5
- package/dist/document2.js +207 -35
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +202 -35
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +81 -4
- package/dist/index.d.ts +81 -4
- package/dist/index.global.js +436 -31
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +436 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +436 -31
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.d.mts +1 -1
- package/dist/react-document.d.ts +1 -1
- package/dist/react-document.js +649 -175
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +649 -175
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +31 -9
- package/dist/react-document2.d.ts +31 -9
- package/dist/react-document2.js +1196 -411
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +1196 -411
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +80 -1
- package/dist/react.d.ts +80 -1
- package/dist/react.js +631 -175
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +631 -175
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react-document2.js
CHANGED
|
@@ -569,6 +569,7 @@ function createInlineField2(value = "", mathObjects = [], options = {}, path = "
|
|
|
569
569
|
opening: span.opening,
|
|
570
570
|
closing: span.closing,
|
|
571
571
|
source: span.source,
|
|
572
|
+
sourceSide: mode,
|
|
572
573
|
math: fromMathObjectJson(mathJson, mode),
|
|
573
574
|
editable: true,
|
|
574
575
|
sourceOwner: "imported-structured"
|
|
@@ -1177,6 +1178,24 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1177
1178
|
title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
|
|
1178
1179
|
svg_path: null
|
|
1179
1180
|
},
|
|
1181
|
+
coloneqq: {
|
|
1182
|
+
id: "coloneqq",
|
|
1183
|
+
category: "operators1",
|
|
1184
|
+
Tex: "\\coloneqq",
|
|
1185
|
+
mirror: true,
|
|
1186
|
+
Label: "\u2254",
|
|
1187
|
+
title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
|
|
1188
|
+
svg_path: null
|
|
1189
|
+
},
|
|
1190
|
+
eqqcolon: {
|
|
1191
|
+
id: "eqqcolon",
|
|
1192
|
+
category: "operators1",
|
|
1193
|
+
Tex: "\\eqqcolon",
|
|
1194
|
+
mirror: true,
|
|
1195
|
+
Label: "\u2255",
|
|
1196
|
+
title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
|
|
1197
|
+
svg_path: null
|
|
1198
|
+
},
|
|
1180
1199
|
///// Operators 2
|
|
1181
1200
|
propto: {
|
|
1182
1201
|
id: "propto",
|
|
@@ -1343,6 +1362,60 @@ var ATOMIC_OPERATOR_COMMANDS = {
|
|
|
1343
1362
|
title: "\u064A\u0643\u0627\u0641\u0626",
|
|
1344
1363
|
svg_path: null
|
|
1345
1364
|
},
|
|
1365
|
+
implies: {
|
|
1366
|
+
id: "implies",
|
|
1367
|
+
category: "operators3",
|
|
1368
|
+
Tex: "\\implies",
|
|
1369
|
+
mirror: true,
|
|
1370
|
+
Label: "\u21D2",
|
|
1371
|
+
title: "\u064A\u0633\u062A\u0644\u0632\u0645",
|
|
1372
|
+
svg_path: null
|
|
1373
|
+
},
|
|
1374
|
+
impliedby: {
|
|
1375
|
+
id: "impliedby",
|
|
1376
|
+
category: "operators3",
|
|
1377
|
+
Tex: "\\impliedby",
|
|
1378
|
+
mirror: true,
|
|
1379
|
+
Label: "\u21D0",
|
|
1380
|
+
title: "\u0645\u0633\u062A\u0644\u0632\u0645 \u0645\u0646",
|
|
1381
|
+
svg_path: null
|
|
1382
|
+
},
|
|
1383
|
+
iff: {
|
|
1384
|
+
id: "iff",
|
|
1385
|
+
category: "operators3",
|
|
1386
|
+
Tex: "\\iff",
|
|
1387
|
+
mirror: false,
|
|
1388
|
+
Label: "\u21D4",
|
|
1389
|
+
title: "\u0625\u0630\u0627 \u0648\u0641\u0642\u0637 \u0625\u0630\u0627",
|
|
1390
|
+
svg_path: null
|
|
1391
|
+
},
|
|
1392
|
+
Longrightarrow: {
|
|
1393
|
+
id: "Longrightarrow",
|
|
1394
|
+
category: "operators3",
|
|
1395
|
+
Tex: "\\Longrightarrow",
|
|
1396
|
+
mirror: true,
|
|
1397
|
+
Label: "\u27F9",
|
|
1398
|
+
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
1399
|
+
svg_path: null
|
|
1400
|
+
},
|
|
1401
|
+
Longleftarrow: {
|
|
1402
|
+
id: "Longleftarrow",
|
|
1403
|
+
category: "operators3",
|
|
1404
|
+
Tex: "\\Longleftarrow",
|
|
1405
|
+
mirror: true,
|
|
1406
|
+
Label: "\u27F8",
|
|
1407
|
+
title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
1408
|
+
svg_path: null
|
|
1409
|
+
},
|
|
1410
|
+
to: {
|
|
1411
|
+
id: "to",
|
|
1412
|
+
category: "operators3",
|
|
1413
|
+
Tex: "\\to",
|
|
1414
|
+
mirror: true,
|
|
1415
|
+
Label: "\u2192",
|
|
1416
|
+
title: "\u064A\u0624\u0648\u0644 \u0625\u0644\u0649",
|
|
1417
|
+
svg_path: null
|
|
1418
|
+
},
|
|
1346
1419
|
rightleftharpoons: {
|
|
1347
1420
|
id: "rightleftharpoons",
|
|
1348
1421
|
category: "operators3",
|
|
@@ -2425,6 +2498,321 @@ function undoRedoCanRedo(stacks) {
|
|
|
2425
2498
|
return stacks.future.length > 0;
|
|
2426
2499
|
}
|
|
2427
2500
|
|
|
2501
|
+
// src/editor/uiLocale.ts
|
|
2502
|
+
var ENGLISH_COMMAND_TITLES = {
|
|
2503
|
+
cos: "Cosine",
|
|
2504
|
+
sin: "Sine",
|
|
2505
|
+
tan: "Tangent",
|
|
2506
|
+
cot: "Cotangent",
|
|
2507
|
+
sec: "Secant",
|
|
2508
|
+
csc: "Cosecant",
|
|
2509
|
+
arccos: "Inverse cosine",
|
|
2510
|
+
arcsin: "Inverse sine",
|
|
2511
|
+
arctan: "Inverse tangent",
|
|
2512
|
+
arccot: "Inverse cotangent",
|
|
2513
|
+
arcsec: "Inverse secant",
|
|
2514
|
+
arccsc: "Inverse cosecant",
|
|
2515
|
+
cosh: "Hyperbolic cosine",
|
|
2516
|
+
sinh: "Hyperbolic sine",
|
|
2517
|
+
tanh: "Hyperbolic tangent",
|
|
2518
|
+
coth: "Hyperbolic cotangent",
|
|
2519
|
+
sum: "Sum",
|
|
2520
|
+
prod: "Product",
|
|
2521
|
+
lim: "Limit",
|
|
2522
|
+
max: "Maximum",
|
|
2523
|
+
min: "Minimum",
|
|
2524
|
+
sup: "Supremum",
|
|
2525
|
+
inf: "Infimum",
|
|
2526
|
+
pi: "Pi",
|
|
2527
|
+
exp: "Exponential",
|
|
2528
|
+
ln: "Natural logarithm",
|
|
2529
|
+
log: "Logarithm",
|
|
2530
|
+
det: "Determinant",
|
|
2531
|
+
N: "Natural numbers",
|
|
2532
|
+
Z: "Integers",
|
|
2533
|
+
Q: "Rational numbers",
|
|
2534
|
+
R: "Real numbers",
|
|
2535
|
+
C: "Complex numbers",
|
|
2536
|
+
H: "Quaternions",
|
|
2537
|
+
negThinSpace: "Negative thin space",
|
|
2538
|
+
mediumSpace: "Medium space",
|
|
2539
|
+
thickSpace: "Thick space",
|
|
2540
|
+
quadSpace: "Large space",
|
|
2541
|
+
qquadSpace: "Extra-large space"
|
|
2542
|
+
};
|
|
2543
|
+
var ENGLISH_OPERATOR_TITLES = {
|
|
2544
|
+
inf: "Infinity",
|
|
2545
|
+
times: "Multiplication",
|
|
2546
|
+
div: "Division",
|
|
2547
|
+
pm: "Plus or minus",
|
|
2548
|
+
mp: "Minus or plus",
|
|
2549
|
+
neq: "Not equal",
|
|
2550
|
+
approx: "Approximately equal",
|
|
2551
|
+
sim: "Similar",
|
|
2552
|
+
mid: "Divides",
|
|
2553
|
+
leq: "Less than or equal",
|
|
2554
|
+
geq: "Greater than or equal",
|
|
2555
|
+
coloneqq: "Defined as equal to",
|
|
2556
|
+
eqqcolon: "Equal by definition",
|
|
2557
|
+
propto: "Proportional to",
|
|
2558
|
+
in: "Element of",
|
|
2559
|
+
notin: "Not an element of",
|
|
2560
|
+
subset: "Subset of",
|
|
2561
|
+
supset: "Superset of",
|
|
2562
|
+
subseteq: "Subset of or equal",
|
|
2563
|
+
supseteq: "Superset of or equal",
|
|
2564
|
+
cap: "Intersection",
|
|
2565
|
+
cup: "Union",
|
|
2566
|
+
emptyset: "Empty set",
|
|
2567
|
+
nsubseteq: "Not a subset of or equal",
|
|
2568
|
+
nsupseteq: "Not a superset of or equal",
|
|
2569
|
+
ldots: "Horizontal dots",
|
|
2570
|
+
cdot: "Multiplication dot",
|
|
2571
|
+
cdots: "Centered horizontal dots",
|
|
2572
|
+
vdots: "Vertical dots",
|
|
2573
|
+
ddots: "Diagonal dots",
|
|
2574
|
+
leftrightarrowDouble: "Equivalent",
|
|
2575
|
+
implies: "Implies",
|
|
2576
|
+
impliedby: "Implied by",
|
|
2577
|
+
iff: "If and only if",
|
|
2578
|
+
Longrightarrow: "Long double arrow right",
|
|
2579
|
+
Longleftarrow: "Long double arrow left",
|
|
2580
|
+
to: "Maps to",
|
|
2581
|
+
rightleftharpoons: "Equilibrium",
|
|
2582
|
+
leftarrow: "Left arrow",
|
|
2583
|
+
rightarrow: "Right arrow",
|
|
2584
|
+
leftarrowDouble: "Double left arrow",
|
|
2585
|
+
rightarrowDouble: "Double right arrow",
|
|
2586
|
+
leftharpoonup: "Upper left harpoon",
|
|
2587
|
+
rightharpoonup: "Upper right harpoon",
|
|
2588
|
+
leftharpoondown: "Lower left harpoon",
|
|
2589
|
+
rightharpoondown: "Lower right harpoon",
|
|
2590
|
+
int: "Integral",
|
|
2591
|
+
iint: "Double integral",
|
|
2592
|
+
iiint: "Triple integral",
|
|
2593
|
+
iiiint: "Quadruple integral",
|
|
2594
|
+
oint: "Contour integral",
|
|
2595
|
+
oiint: "Closed surface integral",
|
|
2596
|
+
oiiint: "Closed volume integral"
|
|
2597
|
+
};
|
|
2598
|
+
var EQUATION_EDITOR_MESSAGES = {
|
|
2599
|
+
ar: {
|
|
2600
|
+
undoRedo: "\u062A\u0631\u0627\u062C\u0639 \u0648\u0625\u0639\u0627\u062F\u0629",
|
|
2601
|
+
undo: "\u062A\u0631\u0627\u062C\u0639",
|
|
2602
|
+
redo: "\u0625\u0639\u0627\u062F\u0629",
|
|
2603
|
+
clipboard: "\u0627\u0644\u062D\u0627\u0641\u0638\u0629",
|
|
2604
|
+
copy: "\u0646\u0633\u062E",
|
|
2605
|
+
cut: "\u0642\u0635",
|
|
2606
|
+
paste: "\u0644\u0635\u0642",
|
|
2607
|
+
editorSettings: "\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0645\u062D\u0631\u0631",
|
|
2608
|
+
toggleSide: "\u062A\u0628\u062F\u064A\u0644 \u0639\u0631\u0628\u064A / \u0625\u0646\u062C\u0644\u064A\u0632\u064A",
|
|
2609
|
+
structures: "\u0627\u0644\u0628\u0646\u0649",
|
|
2610
|
+
insertDelimiters: "\u0625\u062F\u0631\u0627\u062C \u0645\u062D\u062F\u062F\u0627\u062A",
|
|
2611
|
+
insertParentheses: "\u0625\u062F\u0631\u0627\u062C \u0642\u0648\u0633\u064A\u0646",
|
|
2612
|
+
insertBrackets: "\u0625\u062F\u0631\u0627\u062C \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
|
|
2613
|
+
insertBraces: "\u0625\u062F\u0631\u0627\u062C \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
|
|
2614
|
+
insertFraction: "\u0625\u062F\u0631\u0627\u062C \u0643\u0633\u0631",
|
|
2615
|
+
insertRoot: "\u0625\u062F\u0631\u0627\u062C \u062C\u0630\u0631",
|
|
2616
|
+
environments: "\u0627\u0644\u0628\u064A\u0626\u0627\u062A",
|
|
2617
|
+
insertEnvironment: "\u0625\u062F\u0631\u0627\u062C \u0628\u064A\u0626\u0629 \u0634\u0628\u0643\u064A\u0629",
|
|
2618
|
+
environmentType: "\u0646\u0648\u0639 \u0627\u0644\u0628\u064A\u0626\u0629",
|
|
2619
|
+
matrix: "\u0645\u0635\u0641\u0648\u0641\u0629",
|
|
2620
|
+
array: "\u062C\u062F\u0648\u0644",
|
|
2621
|
+
aligned: "\u0645\u062D\u0627\u0630\u0627\u0629",
|
|
2622
|
+
matrixType: "\u0646\u0648\u0639 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629",
|
|
2623
|
+
chooseEnvironmentSize: "\u0627\u062E\u062A\u064A\u0627\u0631 \u062D\u062C\u0645 \u0627\u0644\u0628\u064A\u0626\u0629",
|
|
2624
|
+
rows: "\u0635\u0641\u0648\u0641",
|
|
2625
|
+
columns: "\u0623\u0639\u0645\u062F\u0629",
|
|
2626
|
+
row: "\u0635\u0641",
|
|
2627
|
+
column: "\u0639\u0645\u0648\u062F",
|
|
2628
|
+
insert: "\u0625\u062F\u0631\u0627\u062C",
|
|
2629
|
+
editSelectedEnvironment: "\u062A\u0639\u062F\u064A\u0644 \u0627\u0644\u0628\u064A\u0626\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629",
|
|
2630
|
+
applySelectedMatrixStyle: "\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0646\u0645\u0637 \u0639\u0644\u0649 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629",
|
|
2631
|
+
applyStyle: "\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0646\u0645\u0637",
|
|
2632
|
+
addRow: "\u0625\u0636\u0627\u0641\u0629 \u0635\u0641",
|
|
2633
|
+
removeRow: "\u062D\u0630\u0641 \u0635\u0641",
|
|
2634
|
+
addColumn: "\u0625\u0636\u0627\u0641\u0629 \u0639\u0645\u0648\u062F",
|
|
2635
|
+
removeColumn: "\u062D\u0630\u0641 \u0639\u0645\u0648\u062F",
|
|
2636
|
+
spaces: "\u0627\u0644\u0641\u0631\u0627\u063A\u0627\u062A",
|
|
2637
|
+
insertSpace: "\u0625\u062F\u0631\u0627\u062C \u0641\u0631\u0627\u063A",
|
|
2638
|
+
functions: "\u0627\u0644\u062F\u0648\u0627\u0644",
|
|
2639
|
+
insertFunction: "\u0625\u062F\u0631\u0627\u062C \u062F\u0627\u0644\u0629",
|
|
2640
|
+
insertLimitsSeries: "\u0625\u062F\u0631\u0627\u062C \u062D\u062F\u0648\u062F \u0648\u0645\u062A\u0633\u0644\u0633\u0644\u0627\u062A",
|
|
2641
|
+
insertAdditionalFunctions: "\u0625\u062F\u0631\u0627\u062C \u062F\u0648\u0627\u0644 \u0625\u0636\u0627\u0641\u064A\u0629",
|
|
2642
|
+
insertNumberSets: "\u0625\u062F\u0631\u0627\u062C \u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0623\u0639\u062F\u0627\u062F",
|
|
2643
|
+
operations: "\u0627\u0644\u0639\u0645\u0644\u064A\u0627\u062A",
|
|
2644
|
+
insertOperation: "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0632 \u0639\u0645\u0644\u064A\u0629",
|
|
2645
|
+
insertRelationsSets: "\u0625\u062F\u0631\u0627\u062C \u0631\u0645\u0648\u0632 \u0639\u0644\u0627\u0642\u0627\u062A \u0648\u0645\u062C\u0645\u0648\u0639\u0627\u062A",
|
|
2646
|
+
insertArrows: "\u0625\u062F\u0631\u0627\u062C \u0623\u0633\u0647\u0645",
|
|
2647
|
+
insertDots: "\u0625\u062F\u0631\u0627\u062C \u0646\u0642\u0627\u0637",
|
|
2648
|
+
insertIntegrals: "\u0625\u062F\u0631\u0627\u062C \u062A\u0643\u0627\u0645\u0644\u0627\u062A",
|
|
2649
|
+
scripts: "\u0627\u0644\u0623\u0633 \u0648\u0627\u0644\u0633\u0641\u0644\u064A",
|
|
2650
|
+
addSuperscript: "\u0625\u0636\u0627\u0641\u0629 \u0623\u0633",
|
|
2651
|
+
addSubscript: "\u0625\u0636\u0627\u0641\u0629 \u0633\u0641\u0644\u064A",
|
|
2652
|
+
removeSuperscript: "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0623\u0633",
|
|
2653
|
+
removeSubscript: "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0633\u0641\u0644\u064A",
|
|
2654
|
+
inputStyles: "\u0623\u0646\u0645\u0627\u0637 \u0627\u0644\u0625\u062F\u062E\u0627\u0644",
|
|
2655
|
+
deleteSelectedStructure: "\u062D\u0630\u0641 \u0627\u0644\u0628\u0646\u064A\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629",
|
|
2656
|
+
toggleLetterMerging: "\u062A\u0628\u062F\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641",
|
|
2657
|
+
disableLetterMerging: "\u062A\u0639\u0637\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641",
|
|
2658
|
+
enableLetterMerging: "\u062A\u0641\u0639\u064A\u0644 \u062F\u0645\u062C \u0627\u0644\u062D\u0631\u0648\u0641",
|
|
2659
|
+
chooseWritingFont: "\u0627\u062E\u062A\u064A\u0627\u0631 \u062E\u0637 \u0627\u0644\u0643\u062A\u0627\u0628\u0629",
|
|
2660
|
+
chooseDigitForm: "\u0627\u062E\u062A\u064A\u0627\u0631 \u0634\u0643\u0644 \u0627\u0644\u0623\u0631\u0642\u0627\u0645",
|
|
2661
|
+
defaultFont: "\u0627\u0644\u062E\u0637 \u0627\u0644\u0627\u0641\u062A\u0631\u0627\u0636\u064A",
|
|
2662
|
+
takweenFont: "\u062E\u0637 \u062A\u0643\u0648\u064A\u0646",
|
|
2663
|
+
diwaniFont: "\u062E\u0637 \u062F\u064A\u0648\u0627\u0646\u064A",
|
|
2664
|
+
diwaniOutlineFont: "\u062E\u0637 \u062F\u064A\u0648\u0627\u0646\u064A \u0645\u0638\u0644\u0644",
|
|
2665
|
+
writeDefaultFont: "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u0627\u0644\u062E\u0637 \u0627\u0644\u0627\u0641\u062A\u0631\u0627\u0636\u064A",
|
|
2666
|
+
writeTakweenFont: "\u0627\u0644\u0643\u062A\u0627\u0628\u0629 \u0628\u062E\u0637 \u062A\u0643\u0648\u064A\u0646",
|
|
2667
|
+
westernDigits: "\u0623\u0631\u0642\u0627\u0645 \u063A\u0631\u0628\u064A\u0629",
|
|
2668
|
+
arabicIndicDigits: "\u0623\u0631\u0642\u0627\u0645 \u0639\u0631\u0628\u064A\u0629 \u0647\u0646\u062F\u064A\u0629",
|
|
2669
|
+
persianIndicDigits: "\u0623\u0631\u0642\u0627\u0645 \u0641\u0627\u0631\u0633\u064A\u0629 \u0647\u0646\u062F\u064A\u0629",
|
|
2670
|
+
equationEditor: "\u0645\u062D\u0631\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0627\u062A",
|
|
2671
|
+
renderPreview: "\u0645\u0639\u0627\u064A\u0646\u0629 \u0627\u0644\u0631\u0633\u0645",
|
|
2672
|
+
development: "\u062A\u0637\u0648\u064A\u0631",
|
|
2673
|
+
showDebugLog: "\u0625\u0638\u0647\u0627\u0631 \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",
|
|
2674
|
+
hideDebugLog: "\u0625\u062E\u0641\u0627\u0621 \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",
|
|
2675
|
+
copyDebugLog: "\u0646\u0633\u062E \u0633\u062C\u0644 \u0627\u0644\u062A\u0635\u062D\u064A\u062D",
|
|
2676
|
+
empty: "\u0641\u0627\u0631\u063A",
|
|
2677
|
+
englishLatex: "LaTeX \u0625\u0646\u062C\u0644\u064A\u0632\u064A",
|
|
2678
|
+
arabicLatex: "LaTeX \u0639\u0631\u0628\u064A",
|
|
2679
|
+
inactiveEnglish: "\u0627\u0644\u0633\u0644\u0633\u0644\u0629 \u063A\u064A\u0631 \u0627\u0644\u0646\u0634\u0637\u0629 (\u0625\u0646\u062C\u0644\u064A\u0632\u064A)",
|
|
2680
|
+
inactiveArabic: "\u0627\u0644\u0633\u0644\u0633\u0644\u0629 \u063A\u064A\u0631 \u0627\u0644\u0646\u0634\u0637\u0629 (\u0639\u0631\u0628\u064A)",
|
|
2681
|
+
mathJaxError: "\u062E\u0637\u0623 MathJax",
|
|
2682
|
+
previewError: "\u062E\u0637\u0623 \u0641\u064A \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629",
|
|
2683
|
+
activeSide: "\u0627\u0644\u062C\u0627\u0646\u0628 \u0627\u0644\u0646\u0634\u0637",
|
|
2684
|
+
syncState: "\u062D\u0627\u0644\u0629 \u0627\u0644\u0645\u0632\u0627\u0645\u0646\u0629",
|
|
2685
|
+
arabicSide: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629",
|
|
2686
|
+
englishSide: "\u0627\u0644\u0625\u0646\u062C\u0644\u064A\u0632\u064A\u0629",
|
|
2687
|
+
synced: "\u0645\u062A\u0632\u0627\u0645\u0646",
|
|
2688
|
+
differentItems: "\u0639\u0646\u0627\u0635\u0631 \u0645\u062E\u062A\u0644\u0641\u0629",
|
|
2689
|
+
alignLeft: "\u064A\u0633\u0627\u0631",
|
|
2690
|
+
alignCenter: "\u0648\u0633\u0637",
|
|
2691
|
+
alignRight: "\u064A\u0645\u064A\u0646",
|
|
2692
|
+
alignColumnLeft: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
|
|
2693
|
+
alignColumnCenter: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0641\u064A \u0627\u0644\u0648\u0633\u0637",
|
|
2694
|
+
alignColumnRight: "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0639\u0645\u0648\u062F \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
|
|
2695
|
+
matrixNoDelimiters: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u0644\u0627 \u0623\u0642\u0648\u0627\u0633",
|
|
2696
|
+
matrixParentheses: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0642\u0648\u0633\u064A\u0646",
|
|
2697
|
+
matrixBrackets: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u0645\u0639\u0642\u0648\u0641\u064A\u0646",
|
|
2698
|
+
matrixBraces: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062D\u0627\u0635\u0631\u062A\u064A\u0646",
|
|
2699
|
+
matrixBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646",
|
|
2700
|
+
matrixDoubleBars: "\u0645\u0635\u0641\u0648\u0641\u0629 \u0628\u064A\u0646 \u062E\u0637\u064A\u0646 \u0645\u0632\u062F\u0648\u062C\u064A\u0646"
|
|
2701
|
+
},
|
|
2702
|
+
en: {
|
|
2703
|
+
undoRedo: "Undo and redo",
|
|
2704
|
+
undo: "Undo",
|
|
2705
|
+
redo: "Redo",
|
|
2706
|
+
clipboard: "Clipboard",
|
|
2707
|
+
copy: "Copy",
|
|
2708
|
+
cut: "Cut",
|
|
2709
|
+
paste: "Paste",
|
|
2710
|
+
editorSettings: "Editor settings",
|
|
2711
|
+
toggleSide: "Switch Arabic / English equation side",
|
|
2712
|
+
structures: "Structures",
|
|
2713
|
+
insertDelimiters: "Insert delimiters",
|
|
2714
|
+
insertParentheses: "Insert parentheses",
|
|
2715
|
+
insertBrackets: "Insert brackets",
|
|
2716
|
+
insertBraces: "Insert braces",
|
|
2717
|
+
insertFraction: "Insert fraction",
|
|
2718
|
+
insertRoot: "Insert root",
|
|
2719
|
+
environments: "Environments",
|
|
2720
|
+
insertEnvironment: "Insert grid environment",
|
|
2721
|
+
environmentType: "Environment type",
|
|
2722
|
+
matrix: "Matrix",
|
|
2723
|
+
array: "Array",
|
|
2724
|
+
aligned: "Aligned",
|
|
2725
|
+
matrixType: "Matrix type",
|
|
2726
|
+
chooseEnvironmentSize: "Choose environment size",
|
|
2727
|
+
rows: "Rows",
|
|
2728
|
+
columns: "Columns",
|
|
2729
|
+
row: "Row",
|
|
2730
|
+
column: "Column",
|
|
2731
|
+
insert: "Insert",
|
|
2732
|
+
editSelectedEnvironment: "Edit selected environment",
|
|
2733
|
+
applySelectedMatrixStyle: "Apply style to selected matrix",
|
|
2734
|
+
applyStyle: "Apply style",
|
|
2735
|
+
addRow: "Add row",
|
|
2736
|
+
removeRow: "Remove row",
|
|
2737
|
+
addColumn: "Add column",
|
|
2738
|
+
removeColumn: "Remove column",
|
|
2739
|
+
spaces: "Spacing",
|
|
2740
|
+
insertSpace: "Insert space",
|
|
2741
|
+
functions: "Functions",
|
|
2742
|
+
insertFunction: "Insert function",
|
|
2743
|
+
insertLimitsSeries: "Insert limits and series",
|
|
2744
|
+
insertAdditionalFunctions: "Insert additional functions",
|
|
2745
|
+
insertNumberSets: "Insert number sets",
|
|
2746
|
+
operations: "Operators",
|
|
2747
|
+
insertOperation: "Insert operator",
|
|
2748
|
+
insertRelationsSets: "Insert relation or set symbol",
|
|
2749
|
+
insertArrows: "Insert arrow",
|
|
2750
|
+
insertDots: "Insert dots",
|
|
2751
|
+
insertIntegrals: "Insert integral",
|
|
2752
|
+
scripts: "Superscript and subscript",
|
|
2753
|
+
addSuperscript: "Add superscript",
|
|
2754
|
+
addSubscript: "Add subscript",
|
|
2755
|
+
removeSuperscript: "Remove superscript",
|
|
2756
|
+
removeSubscript: "Remove subscript",
|
|
2757
|
+
inputStyles: "Input styles",
|
|
2758
|
+
deleteSelectedStructure: "Delete selected structure",
|
|
2759
|
+
toggleLetterMerging: "Toggle letter merging",
|
|
2760
|
+
disableLetterMerging: "Disable letter merging",
|
|
2761
|
+
enableLetterMerging: "Enable letter merging",
|
|
2762
|
+
chooseWritingFont: "Choose writing font",
|
|
2763
|
+
chooseDigitForm: "Choose digit form",
|
|
2764
|
+
defaultFont: "Default font",
|
|
2765
|
+
takweenFont: "Takween font",
|
|
2766
|
+
diwaniFont: "Diwani font",
|
|
2767
|
+
diwaniOutlineFont: "Outlined Diwani font",
|
|
2768
|
+
writeDefaultFont: "Write with the default font",
|
|
2769
|
+
writeTakweenFont: "Write with Takween font",
|
|
2770
|
+
westernDigits: "Western digits",
|
|
2771
|
+
arabicIndicDigits: "Arabic-Indic digits",
|
|
2772
|
+
persianIndicDigits: "Persian digits",
|
|
2773
|
+
equationEditor: "Equation editor",
|
|
2774
|
+
renderPreview: "Rendered preview",
|
|
2775
|
+
development: "Development",
|
|
2776
|
+
showDebugLog: "Show debug log",
|
|
2777
|
+
hideDebugLog: "Hide debug log",
|
|
2778
|
+
copyDebugLog: "Copy debug log",
|
|
2779
|
+
empty: "Empty",
|
|
2780
|
+
englishLatex: "English LaTeX",
|
|
2781
|
+
arabicLatex: "Arabic LaTeX",
|
|
2782
|
+
inactiveEnglish: "Inactive chain (English)",
|
|
2783
|
+
inactiveArabic: "Inactive chain (Arabic)",
|
|
2784
|
+
mathJaxError: "MathJax error",
|
|
2785
|
+
previewError: "Preview error",
|
|
2786
|
+
activeSide: "Active side",
|
|
2787
|
+
syncState: "Sync state",
|
|
2788
|
+
arabicSide: "Arabic",
|
|
2789
|
+
englishSide: "English",
|
|
2790
|
+
synced: "Synced",
|
|
2791
|
+
differentItems: "different items",
|
|
2792
|
+
alignLeft: "Left",
|
|
2793
|
+
alignCenter: "Center",
|
|
2794
|
+
alignRight: "Right",
|
|
2795
|
+
alignColumnLeft: "Align column left",
|
|
2796
|
+
alignColumnCenter: "Align column center",
|
|
2797
|
+
alignColumnRight: "Align column right",
|
|
2798
|
+
matrixNoDelimiters: "Matrix without delimiters",
|
|
2799
|
+
matrixParentheses: "Matrix in parentheses",
|
|
2800
|
+
matrixBrackets: "Matrix in brackets",
|
|
2801
|
+
matrixBraces: "Matrix in braces",
|
|
2802
|
+
matrixBars: "Matrix between bars",
|
|
2803
|
+
matrixDoubleBars: "Matrix between double bars"
|
|
2804
|
+
}
|
|
2805
|
+
};
|
|
2806
|
+
function equationEditorMessages(locale) {
|
|
2807
|
+
return EQUATION_EDITOR_MESSAGES[locale];
|
|
2808
|
+
}
|
|
2809
|
+
function atomicCommandTitle(spec, locale) {
|
|
2810
|
+
return locale === "en" ? ENGLISH_COMMAND_TITLES[spec.id] ?? spec.title : spec.title;
|
|
2811
|
+
}
|
|
2812
|
+
function atomicOperatorCommandTitle(spec, locale) {
|
|
2813
|
+
return locale === "en" ? ENGLISH_OPERATOR_TITLES[spec.id] ?? spec.title : spec.title;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2428
2816
|
// src/editor/state.ts
|
|
2429
2817
|
function ensureSyncEntry(session, nodeId) {
|
|
2430
2818
|
if (!session.sync[nodeId]) {
|
|
@@ -4121,8 +4509,8 @@ function spacingArrowForSide(spec, side) {
|
|
|
4121
4509
|
}
|
|
4122
4510
|
return side === "arabic" ? "\u2192" : "\u2190";
|
|
4123
4511
|
}
|
|
4124
|
-
function spacingTooltipForSide(spec, side) {
|
|
4125
|
-
return `${spec
|
|
4512
|
+
function spacingTooltipForSide(spec, side, uiLocale = "ar") {
|
|
4513
|
+
return `${atomicCommandTitle(spec, uiLocale)} ${spacingArrowForSide(spec, side).repeat(spec.spacing.level)}`;
|
|
4126
4514
|
}
|
|
4127
4515
|
function buildFunctionAtomicCommandBody(node, side, spec) {
|
|
4128
4516
|
const value = document.createElement("span");
|
|
@@ -4146,19 +4534,19 @@ function buildFunctionAtomicCommandBody(node, side, spec) {
|
|
|
4146
4534
|
value.textContent = side === "arabic" ? spec?.arabicLabel ?? node.expr : spec?.englishTex.replace("\\", "") ?? node.expr;
|
|
4147
4535
|
return value;
|
|
4148
4536
|
}
|
|
4149
|
-
function buildSpacingAtomicCommandBody(spec, side) {
|
|
4537
|
+
function buildSpacingAtomicCommandBody(spec, side, uiLocale) {
|
|
4150
4538
|
const value = document.createElement("span");
|
|
4151
4539
|
value.className = `atomic-spacing atomic-spacing--${spec.spacing.direction} atomic-spacing--level-${String(spec.spacing.level)}`;
|
|
4152
|
-
value.title = spacingTooltipForSide(spec, side);
|
|
4540
|
+
value.title = spacingTooltipForSide(spec, side, uiLocale);
|
|
4153
4541
|
const marker = document.createElement("span");
|
|
4154
4542
|
marker.className = "atomic-spacing__marker";
|
|
4155
4543
|
value.appendChild(marker);
|
|
4156
4544
|
return value;
|
|
4157
4545
|
}
|
|
4158
|
-
function buildAtomicCommandNodeBody(node, side) {
|
|
4546
|
+
function buildAtomicCommandNodeBody(node, side, uiLocale = "ar") {
|
|
4159
4547
|
const spec = atomicCommandSpec(node.expr);
|
|
4160
4548
|
if (isSpacingCommandSpec(spec)) {
|
|
4161
|
-
return buildSpacingAtomicCommandBody(spec, side);
|
|
4549
|
+
return buildSpacingAtomicCommandBody(spec, side, uiLocale);
|
|
4162
4550
|
}
|
|
4163
4551
|
return buildFunctionAtomicCommandBody(node, side, spec);
|
|
4164
4552
|
}
|
|
@@ -4192,11 +4580,11 @@ function buildOperatorLabel(spec) {
|
|
|
4192
4580
|
value.textContent = spec.Label;
|
|
4193
4581
|
return value;
|
|
4194
4582
|
}
|
|
4195
|
-
function buildAtomicOperatorCommandNodeBody(node, side) {
|
|
4583
|
+
function buildAtomicOperatorCommandNodeBody(node, side, uiLocale = "ar") {
|
|
4196
4584
|
const spec = atomicOperatorCommandSpec(node.expr);
|
|
4197
4585
|
const value = document.createElement("span");
|
|
4198
4586
|
value.className = "atomic-operator-command";
|
|
4199
|
-
value.title = spec
|
|
4587
|
+
value.title = spec ? atomicOperatorCommandTitle(spec, uiLocale) : node.expr;
|
|
4200
4588
|
if (side === "arabic" && shouldMirrorOperatorDisplay(spec)) {
|
|
4201
4589
|
value.classList.add("atomic-operator-command--mirrored");
|
|
4202
4590
|
}
|
|
@@ -4250,7 +4638,7 @@ function buildNodeScripts(node, buildChain) {
|
|
|
4250
4638
|
}
|
|
4251
4639
|
|
|
4252
4640
|
// src/editor/display/index.ts
|
|
4253
|
-
function buildNodeBody(node, buildChain, side, digitForm = "western") {
|
|
4641
|
+
function buildNodeBody(node, buildChain, side, digitForm = "western", uiLocale = "ar") {
|
|
4254
4642
|
if (node.kind === "delimiter") {
|
|
4255
4643
|
return buildDelimiterNodeBody(node, buildChain);
|
|
4256
4644
|
}
|
|
@@ -4264,10 +4652,10 @@ function buildNodeBody(node, buildChain, side, digitForm = "western") {
|
|
|
4264
4652
|
return buildMatrixEnvNodeBody(node, buildChain, side);
|
|
4265
4653
|
}
|
|
4266
4654
|
if (node.kind === "atomicCommand") {
|
|
4267
|
-
return buildAtomicCommandNodeBody(node, side);
|
|
4655
|
+
return buildAtomicCommandNodeBody(node, side, uiLocale);
|
|
4268
4656
|
}
|
|
4269
4657
|
if (node.kind === "atomicOperatorCommand") {
|
|
4270
|
-
return buildAtomicOperatorCommandNodeBody(node, side);
|
|
4658
|
+
return buildAtomicOperatorCommandNodeBody(node, side, uiLocale);
|
|
4271
4659
|
}
|
|
4272
4660
|
return buildBaseNodeBody(node, digitForm);
|
|
4273
4661
|
}
|
|
@@ -4488,6 +4876,10 @@ function createEditorRuntime(options) {
|
|
|
4488
4876
|
const buttonElements = options.buttonElements ?? {};
|
|
4489
4877
|
const outsidePointerIgnoreSelectors = options.outsidePointerIgnoreSelectors ?? [];
|
|
4490
4878
|
let session = options.initialSession ?? createStarterSession();
|
|
4879
|
+
let uiLocale = options.uiLocale ?? "ar";
|
|
4880
|
+
if (options.defaultSide) {
|
|
4881
|
+
session = { ...session, activeSide: options.defaultSide };
|
|
4882
|
+
}
|
|
4491
4883
|
const undoRedo = createUndoRedoStacks();
|
|
4492
4884
|
let lastInternalFragment = null;
|
|
4493
4885
|
let initialKeyboardFocusPending = true;
|
|
@@ -4519,14 +4911,15 @@ function createEditorRuntime(options) {
|
|
|
4519
4911
|
return index >= start && index < end;
|
|
4520
4912
|
}
|
|
4521
4913
|
function refreshUndoRedoButtons() {
|
|
4914
|
+
const messages = equationEditorMessages(uiLocale);
|
|
4522
4915
|
if (buttonElements.undoBtn) {
|
|
4523
4916
|
buttonElements.undoBtn.disabled = !undoRedoCanUndo(undoRedo);
|
|
4524
4917
|
const arabicEquation = session.activeSide === "arabic";
|
|
4525
4918
|
const undoArrow = arabicEquation ? "\u21B7" : "\u21B6";
|
|
4526
4919
|
const vs = "\uFE0E";
|
|
4527
4920
|
buttonElements.undoBtn.textContent = `${undoArrow}${vs}`;
|
|
4528
|
-
buttonElements.undoBtn.title =
|
|
4529
|
-
buttonElements.undoBtn.setAttribute("aria-label",
|
|
4921
|
+
buttonElements.undoBtn.title = messages.undo;
|
|
4922
|
+
buttonElements.undoBtn.setAttribute("aria-label", messages.undo);
|
|
4530
4923
|
}
|
|
4531
4924
|
if (buttonElements.redoBtn) {
|
|
4532
4925
|
buttonElements.redoBtn.disabled = !undoRedoCanRedo(undoRedo);
|
|
@@ -4534,8 +4927,8 @@ function createEditorRuntime(options) {
|
|
|
4534
4927
|
const redoArrow = arabicEquation ? "\u21B6" : "\u21B7";
|
|
4535
4928
|
const vs = "\uFE0E";
|
|
4536
4929
|
buttonElements.redoBtn.textContent = `${redoArrow}${vs}`;
|
|
4537
|
-
buttonElements.redoBtn.title =
|
|
4538
|
-
buttonElements.redoBtn.setAttribute("aria-label",
|
|
4930
|
+
buttonElements.redoBtn.title = messages.redo;
|
|
4931
|
+
buttonElements.redoBtn.setAttribute("aria-label", messages.redo);
|
|
4539
4932
|
}
|
|
4540
4933
|
}
|
|
4541
4934
|
function refreshClipboardButtons() {
|
|
@@ -4554,9 +4947,10 @@ function createEditorRuntime(options) {
|
|
|
4554
4947
|
return;
|
|
4555
4948
|
}
|
|
4556
4949
|
const mergeOn = !session.splitLeafTyping;
|
|
4950
|
+
const messages = equationEditorMessages(uiLocale);
|
|
4557
4951
|
buttonElements.splitTypingBtn.textContent = mergeOn ? "\u0633\u0635\u0639" : "\u0633 \u0635 \u0639";
|
|
4558
|
-
buttonElements.splitTypingBtn.title = mergeOn ?
|
|
4559
|
-
buttonElements.splitTypingBtn.setAttribute("aria-label", mergeOn ?
|
|
4952
|
+
buttonElements.splitTypingBtn.title = mergeOn ? messages.disableLetterMerging : messages.enableLetterMerging;
|
|
4953
|
+
buttonElements.splitTypingBtn.setAttribute("aria-label", mergeOn ? messages.disableLetterMerging : messages.enableLetterMerging);
|
|
4560
4954
|
buttonElements.splitTypingBtn.setAttribute("aria-pressed", mergeOn ? "true" : "false");
|
|
4561
4955
|
buttonElements.splitTypingBtn.classList.toggle("accent", mergeOn);
|
|
4562
4956
|
}
|
|
@@ -4565,9 +4959,10 @@ function createEditorRuntime(options) {
|
|
|
4565
4959
|
return;
|
|
4566
4960
|
}
|
|
4567
4961
|
const takweenOn = (session.currentCharacterFont ?? "default") === "takween";
|
|
4962
|
+
const messages = equationEditorMessages(uiLocale);
|
|
4568
4963
|
buttonElements.characterFontBtn.textContent = "\u062A\u0643";
|
|
4569
|
-
buttonElements.characterFontBtn.title = takweenOn ?
|
|
4570
|
-
buttonElements.characterFontBtn.setAttribute("aria-label", takweenOn ?
|
|
4964
|
+
buttonElements.characterFontBtn.title = takweenOn ? messages.writeDefaultFont : messages.writeTakweenFont;
|
|
4965
|
+
buttonElements.characterFontBtn.setAttribute("aria-label", takweenOn ? messages.writeDefaultFont : messages.writeTakweenFont);
|
|
4571
4966
|
buttonElements.characterFontBtn.setAttribute("aria-pressed", takweenOn ? "true" : "false");
|
|
4572
4967
|
buttonElements.characterFontBtn.classList.toggle("accent", takweenOn);
|
|
4573
4968
|
}
|
|
@@ -4578,8 +4973,9 @@ function createEditorRuntime(options) {
|
|
|
4578
4973
|
const digitForm = session.currentDigitForm ?? "western";
|
|
4579
4974
|
const label = digitForm === "arabicIndic" ? "\u0664\u0665\u0666" : digitForm === "persianIndic" ? "\u06F4\u06F5\u06F6" : "456";
|
|
4580
4975
|
buttonElements.digitFormBtn.textContent = label;
|
|
4581
|
-
|
|
4582
|
-
buttonElements.digitFormBtn.
|
|
4976
|
+
const messages = equationEditorMessages(uiLocale);
|
|
4977
|
+
buttonElements.digitFormBtn.title = messages.chooseDigitForm;
|
|
4978
|
+
buttonElements.digitFormBtn.setAttribute("aria-label", messages.chooseDigitForm);
|
|
4583
4979
|
buttonElements.digitFormBtn.dataset.digitForm = digitForm;
|
|
4584
4980
|
}
|
|
4585
4981
|
function applyStructural(updater) {
|
|
@@ -4781,7 +5177,7 @@ function createEditorRuntime(options) {
|
|
|
4781
5177
|
const atomicSpec = node.kind === "atomicCommand" ? atomicCommandSpec(node.expr) : null;
|
|
4782
5178
|
if (isSpacingCommandSpec(atomicSpec)) {
|
|
4783
5179
|
nodeEl.classList.add("node--atomic-spacing");
|
|
4784
|
-
nodeEl.title = spacingTooltipForSide(atomicSpec, session.activeSide);
|
|
5180
|
+
nodeEl.title = spacingTooltipForSide(atomicSpec, session.activeSide, uiLocale);
|
|
4785
5181
|
}
|
|
4786
5182
|
if (session.selectedNodeId === node.id || session.selectedStructureNodeId === node.id) {
|
|
4787
5183
|
nodeEl.classList.add("selected");
|
|
@@ -4811,7 +5207,7 @@ function createEditorRuntime(options) {
|
|
|
4811
5207
|
});
|
|
4812
5208
|
const body = document.createElement("span");
|
|
4813
5209
|
body.className = "node-body";
|
|
4814
|
-
body.appendChild(buildNodeBody(node, buildChain, session.activeSide, session.currentDigitForm ?? "western"));
|
|
5210
|
+
body.appendChild(buildNodeBody(node, buildChain, session.activeSide, session.currentDigitForm ?? "western", uiLocale));
|
|
4815
5211
|
nodeEl.appendChild(body);
|
|
4816
5212
|
const scripts = buildNodeScripts(node, buildChain);
|
|
4817
5213
|
if (scripts) {
|
|
@@ -5092,6 +5488,13 @@ function createEditorRuntime(options) {
|
|
|
5092
5488
|
session = next;
|
|
5093
5489
|
render();
|
|
5094
5490
|
},
|
|
5491
|
+
setUiLocale: (locale) => {
|
|
5492
|
+
if (uiLocale === locale) {
|
|
5493
|
+
return;
|
|
5494
|
+
}
|
|
5495
|
+
uiLocale = locale;
|
|
5496
|
+
render();
|
|
5497
|
+
},
|
|
5095
5498
|
performUndo,
|
|
5096
5499
|
performRedo,
|
|
5097
5500
|
performCopy,
|
|
@@ -5567,15 +5970,15 @@ function mathNodeFromEditorSession(session, mathMode = "$", closing = "$") {
|
|
|
5567
5970
|
}
|
|
5568
5971
|
|
|
5569
5972
|
// src/document2/mathBridge.ts
|
|
5570
|
-
function
|
|
5973
|
+
function createEmptyEquationSession(side = "arabic") {
|
|
5571
5974
|
const english = createEditorChain();
|
|
5572
5975
|
const arabic = createEditorChain();
|
|
5573
5976
|
arabic.id = english.id;
|
|
5574
|
-
const session = createEditorSession(english, arabic,
|
|
5977
|
+
const session = createEditorSession(english, arabic, side);
|
|
5575
5978
|
session.sync = buildInitialSyncMap(session.englishTree, session.arabicTree);
|
|
5576
5979
|
return session;
|
|
5577
5980
|
}
|
|
5578
|
-
function
|
|
5981
|
+
function mathTokenToEditorSession(math, side = "arabic") {
|
|
5579
5982
|
if (!math) {
|
|
5580
5983
|
return { editable: false, reason: "\u0647\u0630\u0647 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629 \u0645\u062D\u0641\u0648\u0638\u0629 \u0643\u0646\u0635 \u062E\u0627\u0645 \u0641\u0642\u0637 \u062D\u0627\u0644\u064A\u0627" };
|
|
5581
5984
|
}
|
|
@@ -5583,12 +5986,12 @@ function mathTokenToArabicEditorSession(math) {
|
|
|
5583
5986
|
if (!result.editable) {
|
|
5584
5987
|
return result;
|
|
5585
5988
|
}
|
|
5586
|
-
result.session.activeSide =
|
|
5989
|
+
result.session.activeSide = side;
|
|
5587
5990
|
result.session.sync = buildInitialSyncMap(result.session.englishTree, result.session.arabicTree);
|
|
5588
5991
|
return result;
|
|
5589
5992
|
}
|
|
5590
|
-
function
|
|
5591
|
-
const inner = renderArabicLatexFromSession(session);
|
|
5993
|
+
function mathSourceFromSession(session, side, opening = "$", closing = "$") {
|
|
5994
|
+
const inner = side === "english" ? renderEnglishLatexFromSession(session) : renderArabicLatexFromSession(session);
|
|
5592
5995
|
if (opening === "$" || opening === "\\(") {
|
|
5593
5996
|
return opening + inner + closing;
|
|
5594
5997
|
}
|
|
@@ -5601,13 +6004,26 @@ ${closing}`;
|
|
|
5601
6004
|
${inner}
|
|
5602
6005
|
${closing}`;
|
|
5603
6006
|
}
|
|
5604
|
-
function
|
|
6007
|
+
function mathNodeFromSession(session, opening = "$", closing = "$") {
|
|
5605
6008
|
const converted = mathNodeFromEditorSession(session, opening, closing);
|
|
5606
6009
|
if (converted.ok) {
|
|
5607
6010
|
return converted.math;
|
|
5608
6011
|
}
|
|
5609
6012
|
return { nodeType: "MathObject", mathMode: opening, lines: [], closing };
|
|
5610
6013
|
}
|
|
6014
|
+
function mathTokenSourceForSide(token, side) {
|
|
6015
|
+
if (!token.math || token.sourceOwner === "raw") {
|
|
6016
|
+
return token.source;
|
|
6017
|
+
}
|
|
6018
|
+
if (token.sourceSide === side) {
|
|
6019
|
+
return token.source;
|
|
6020
|
+
}
|
|
6021
|
+
const result = mathTokenToEditorSession(token.math, side);
|
|
6022
|
+
if (!result.editable) {
|
|
6023
|
+
return token.source;
|
|
6024
|
+
}
|
|
6025
|
+
return mathSourceFromSession(result.session, side, token.opening, token.closing);
|
|
6026
|
+
}
|
|
5611
6027
|
|
|
5612
6028
|
// src/document2/commands.ts
|
|
5613
6029
|
function cloneToken(token) {
|
|
@@ -5684,15 +6100,16 @@ function updateTextToken(document2, fieldId, tokenId, text) {
|
|
|
5684
6100
|
});
|
|
5685
6101
|
return next;
|
|
5686
6102
|
}
|
|
5687
|
-
function mathTokenFromSession(session, opening = "$", closing = "$") {
|
|
6103
|
+
function mathTokenFromSession(session, opening = "$", closing = "$", side = "arabic") {
|
|
5688
6104
|
return {
|
|
5689
6105
|
id: document2Id("math"),
|
|
5690
6106
|
kind: "math",
|
|
5691
6107
|
display: opening === "$$" || opening === "\\[" || opening.startsWith("\\begin{"),
|
|
5692
6108
|
opening,
|
|
5693
6109
|
closing,
|
|
5694
|
-
source:
|
|
5695
|
-
|
|
6110
|
+
source: mathSourceFromSession(session, side, opening, closing),
|
|
6111
|
+
sourceSide: side,
|
|
6112
|
+
math: mathNodeFromSession(session, opening, closing),
|
|
5696
6113
|
editable: true,
|
|
5697
6114
|
sourceOwner: "editor"
|
|
5698
6115
|
};
|
|
@@ -5768,9 +6185,9 @@ function splitTextTokenAt(token, offset) {
|
|
|
5768
6185
|
{ id: document2Id("text"), kind: "text", text: token.text.slice(safeOffset) }
|
|
5769
6186
|
];
|
|
5770
6187
|
}
|
|
5771
|
-
function insertMathTokenAtCaret(document2, fieldId, textTokenId, caretOffset, session, opening = "$", closing = "$") {
|
|
6188
|
+
function insertMathTokenAtCaret(document2, fieldId, textTokenId, caretOffset, session, opening = "$", closing = "$", side = "arabic") {
|
|
5772
6189
|
const next = cloneDocument(document2);
|
|
5773
|
-
const mathToken = mathTokenFromSession(session, opening, closing);
|
|
6190
|
+
const mathToken = mathTokenFromSession(session, opening, closing, side);
|
|
5774
6191
|
visitFields(next.blocks, (field) => {
|
|
5775
6192
|
if (field.id !== fieldId) {
|
|
5776
6193
|
return false;
|
|
@@ -5795,7 +6212,7 @@ function insertMathTokenAtCaret(document2, fieldId, textTokenId, caretOffset, se
|
|
|
5795
6212
|
});
|
|
5796
6213
|
return next;
|
|
5797
6214
|
}
|
|
5798
|
-
function replaceMathTokenFromSession(document2, tokenId, session, opening, closing) {
|
|
6215
|
+
function replaceMathTokenFromSession(document2, tokenId, session, opening, closing, side = "arabic") {
|
|
5799
6216
|
const next = cloneDocument(document2);
|
|
5800
6217
|
visitFields(next.blocks, (field) => {
|
|
5801
6218
|
const index = field.tokens.findIndex((token) => token.id === tokenId && token.kind === "math");
|
|
@@ -5805,7 +6222,7 @@ function replaceMathTokenFromSession(document2, tokenId, session, opening, closi
|
|
|
5805
6222
|
const current = field.tokens[index];
|
|
5806
6223
|
const open = opening ?? current.opening;
|
|
5807
6224
|
const close = closing ?? current.closing;
|
|
5808
|
-
field.tokens[index] = mathTokenFromSession(session, open, close);
|
|
6225
|
+
field.tokens[index] = mathTokenFromSession(session, open, close, side);
|
|
5809
6226
|
field.tokens[index].id = current.id;
|
|
5810
6227
|
return true;
|
|
5811
6228
|
});
|
|
@@ -6017,23 +6434,20 @@ function document2HistoryCanRedo(stacks) {
|
|
|
6017
6434
|
}
|
|
6018
6435
|
|
|
6019
6436
|
// src/document2/previewModel.ts
|
|
6020
|
-
function mathTex(token) {
|
|
6437
|
+
function mathTex(token, equationSide) {
|
|
6021
6438
|
if (token.kind === "text") {
|
|
6022
6439
|
return token.text;
|
|
6023
6440
|
}
|
|
6024
|
-
|
|
6025
|
-
return token.source;
|
|
6026
|
-
}
|
|
6027
|
-
return renderMathNodeLatex(token.math);
|
|
6441
|
+
return mathTokenSourceForSide(token, equationSide);
|
|
6028
6442
|
}
|
|
6029
|
-
function previewInlines(field, islands, output) {
|
|
6443
|
+
function previewInlines(field, islands, output, equationSide) {
|
|
6030
6444
|
return field.tokens.map((token) => {
|
|
6031
6445
|
if (token.kind === "text") {
|
|
6032
6446
|
return { kind: "text", text: token.text };
|
|
6033
6447
|
}
|
|
6034
6448
|
const island = {
|
|
6035
6449
|
id: token.id,
|
|
6036
|
-
tex: mathTex(token),
|
|
6450
|
+
tex: mathTex(token, equationSide),
|
|
6037
6451
|
display: token.display,
|
|
6038
6452
|
output,
|
|
6039
6453
|
editable: token.editable
|
|
@@ -6042,21 +6456,21 @@ function previewInlines(field, islands, output) {
|
|
|
6042
6456
|
return { kind: "math", ...island };
|
|
6043
6457
|
});
|
|
6044
6458
|
}
|
|
6045
|
-
function textBlockPreview(block, islands, output) {
|
|
6459
|
+
function textBlockPreview(block, islands, output, equationSide) {
|
|
6046
6460
|
if (block.command === "\\section") {
|
|
6047
|
-
return { kind: "heading", id: block.id, level: 1, inlines: previewInlines(block.field, islands, output) };
|
|
6461
|
+
return { kind: "heading", id: block.id, level: 1, inlines: previewInlines(block.field, islands, output, equationSide) };
|
|
6048
6462
|
}
|
|
6049
6463
|
if (block.command === "\\subsection") {
|
|
6050
|
-
return { kind: "heading", id: block.id, level: 2, inlines: previewInlines(block.field, islands, output) };
|
|
6464
|
+
return { kind: "heading", id: block.id, level: 2, inlines: previewInlines(block.field, islands, output, equationSide) };
|
|
6051
6465
|
}
|
|
6052
6466
|
if (block.command === "\\subsubsection") {
|
|
6053
|
-
return { kind: "heading", id: block.id, level: 3, inlines: previewInlines(block.field, islands, output) };
|
|
6467
|
+
return { kind: "heading", id: block.id, level: 3, inlines: previewInlines(block.field, islands, output, equationSide) };
|
|
6054
6468
|
}
|
|
6055
|
-
return { kind: "paragraph", id: block.id, inlines: previewInlines(block.field, islands, output) };
|
|
6469
|
+
return { kind: "paragraph", id: block.id, inlines: previewInlines(block.field, islands, output, equationSide) };
|
|
6056
6470
|
}
|
|
6057
|
-
function blockPreview(block, islands, output) {
|
|
6471
|
+
function blockPreview(block, islands, output, equationSide) {
|
|
6058
6472
|
if (block.kind === "textBlock") {
|
|
6059
|
-
return textBlockPreview(block, islands, output);
|
|
6473
|
+
return textBlockPreview(block, islands, output, equationSide);
|
|
6060
6474
|
}
|
|
6061
6475
|
if (block.kind === "list") {
|
|
6062
6476
|
return {
|
|
@@ -6065,23 +6479,23 @@ function blockPreview(block, islands, output) {
|
|
|
6065
6479
|
ordered: block.command === "\\begin{enumerate}",
|
|
6066
6480
|
items: block.items.map((item) => ({
|
|
6067
6481
|
id: item.id,
|
|
6068
|
-
inlines: previewInlines(item.field, islands, output),
|
|
6069
|
-
blocks: item.blocks.map((child) => blockPreview(child, islands, output))
|
|
6482
|
+
inlines: previewInlines(item.field, islands, output, equationSide),
|
|
6483
|
+
blocks: item.blocks.map((child) => blockPreview(child, islands, output, equationSide))
|
|
6070
6484
|
}))
|
|
6071
6485
|
};
|
|
6072
6486
|
}
|
|
6073
6487
|
if (block.kind === "table") {
|
|
6074
|
-
return { kind: "table", id: block.id, rows: block.rows.map((row) => row.map((cell) => previewInlines(cell, islands, output))) };
|
|
6488
|
+
return { kind: "table", id: block.id, rows: block.rows.map((row) => row.map((cell) => previewInlines(cell, islands, output, equationSide))) };
|
|
6075
6489
|
}
|
|
6076
6490
|
if (block.kind === "image") {
|
|
6077
6491
|
return { kind: "image", id: block.id, src: block.value, options: block.options };
|
|
6078
6492
|
}
|
|
6079
6493
|
return { kind: "omit", id: block.id };
|
|
6080
6494
|
}
|
|
6081
|
-
function document2Preview(document2, output = "svg") {
|
|
6495
|
+
function document2Preview(document2, output = "svg", equationSide = "arabic") {
|
|
6082
6496
|
const mathIslands = [];
|
|
6083
6497
|
return {
|
|
6084
|
-
blocks: document2.blocks.map((block) => blockPreview(block, mathIslands, output)),
|
|
6498
|
+
blocks: document2.blocks.map((block) => blockPreview(block, mathIslands, output, equationSide)),
|
|
6085
6499
|
mathIslands
|
|
6086
6500
|
};
|
|
6087
6501
|
}
|
|
@@ -6516,11 +6930,166 @@ function MathIsland({ id, tex, display, output = "svg" }) {
|
|
|
6516
6930
|
);
|
|
6517
6931
|
}
|
|
6518
6932
|
|
|
6933
|
+
// src/react-document2/uiMessages.ts
|
|
6934
|
+
var DOCUMENT2_MESSAGES = {
|
|
6935
|
+
ar: {
|
|
6936
|
+
undoRedo: "\u062A\u0631\u0627\u062C\u0639 \u0648\u0625\u0639\u0627\u062F\u0629",
|
|
6937
|
+
undo: "\u062A\u0631\u0627\u062C\u0639",
|
|
6938
|
+
redo: "\u0625\u0639\u0627\u062F\u0629",
|
|
6939
|
+
structure: "\u0647\u064A\u0643\u0644",
|
|
6940
|
+
content: "\u0645\u062D\u062A\u0648\u0649",
|
|
6941
|
+
addSection: "\u0625\u0636\u0627\u0641\u0629 \u0642\u0633\u0645",
|
|
6942
|
+
addSubsection: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639",
|
|
6943
|
+
addSubsubsection: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0631\u0639 \u0635\u063A\u064A\u0631",
|
|
6944
|
+
addParagraph: "\u0625\u0636\u0627\u0641\u0629 \u0641\u0642\u0631\u0629",
|
|
6945
|
+
inlineEquation: "\u0645\u0639\u0627\u062F\u0644\u0629 \u062F\u0627\u062E\u0644 \u0627\u0644\u0633\u0637\u0631",
|
|
6946
|
+
displayEquation: "\u0645\u0639\u0627\u062F\u0644\u0629 \u0645\u0639\u0631\u0648\u0636\u0629",
|
|
6947
|
+
bulletedList: "\u0642\u0627\u0626\u0645\u0629 \u0646\u0642\u0637\u064A\u0629",
|
|
6948
|
+
numberedList: "\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u0642\u0645\u0629",
|
|
6949
|
+
insertImage: "\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629",
|
|
6950
|
+
insertTable: "\u0625\u062F\u0631\u0627\u062C \u062C\u062F\u0648\u0644",
|
|
6951
|
+
tableSize: "\u062D\u062C\u0645 \u0627\u0644\u062C\u062F\u0648\u0644",
|
|
6952
|
+
rows: "\u0635\u0641\u0648\u0641",
|
|
6953
|
+
columns: "\u0623\u0639\u0645\u062F\u0629",
|
|
6954
|
+
insert: "\u0625\u062F\u0631\u0627\u062C",
|
|
6955
|
+
panels: "\u0627\u0644\u0644\u0648\u062D\u0627\u062A",
|
|
6956
|
+
hideEditor: "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062A\u062D\u0631\u064A\u0631",
|
|
6957
|
+
editor: "\u062A\u062D\u0631\u064A\u0631",
|
|
6958
|
+
hidePreview: "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629",
|
|
6959
|
+
preview: "\u0645\u0639\u0627\u064A\u0646\u0629",
|
|
6960
|
+
collapseBlocks: "\u0637\u064A \u0627\u0644\u0643\u062A\u0644",
|
|
6961
|
+
collapseAll: "\u0637\u064A \u0627\u0644\u0643\u0644",
|
|
6962
|
+
openAll: "\u0641\u062A\u062D \u0627\u0644\u0643\u0644",
|
|
6963
|
+
documentEditor: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
|
|
6964
|
+
documentPreview: "\u0645\u0639\u0627\u064A\u0646\u0629 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
|
|
6965
|
+
importWarnings: "\u062A\u0646\u0628\u064A\u0647\u0627\u062A \u0627\u0644\u0627\u0633\u062A\u064A\u0631\u0627\u062F (\u0648\u0636\u0639 \u0627\u0644\u062A\u0637\u0648\u064A\u0631)",
|
|
6966
|
+
emptyDocument: "\u0627\u0644\u0645\u0633\u062A\u0646\u062F \u0641\u0627\u0631\u063A",
|
|
6967
|
+
text: "\u0646\u0635",
|
|
6968
|
+
editEquation: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
6969
|
+
rawEquation: "\u0645\u0639\u0627\u062F\u0644\u0629 \u062E\u0627\u0645",
|
|
6970
|
+
deleteEquation: "\u062D\u0630\u0641 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
6971
|
+
equationUnavailable: "\u0647\u0630\u0647 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629 \u063A\u064A\u0631 \u0645\u062A\u0627\u062D\u0629 \u0644\u0644\u062A\u062D\u0631\u064A\u0631 \u062D\u0627\u0644\u064A\u0627",
|
|
6972
|
+
closeEquationDialog: "\u0625\u063A\u0644\u0627\u0642 \u0646\u0627\u0641\u0630\u0629 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
6973
|
+
equationEditorTitle: "\u062A\u062D\u0631\u064A\u0631 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
6974
|
+
close: "\u0625\u063A\u0644\u0627\u0642",
|
|
6975
|
+
equationType: "\u0646\u0648\u0639 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
6976
|
+
inline: "\u062F\u0627\u062E\u0644 \u0627\u0644\u0633\u0637\u0631",
|
|
6977
|
+
displayed: "\u0645\u0639\u0631\u0648\u0636\u0629",
|
|
6978
|
+
saveEquation: "\u062D\u0641\u0638 \u0627\u0644\u0645\u0639\u0627\u062F\u0644\u0629",
|
|
6979
|
+
section: "\u0642\u0633\u0645",
|
|
6980
|
+
subsection: "\u0641\u0631\u0639",
|
|
6981
|
+
subsubsection: "\u0641\u0631\u0639 \u0635\u063A\u064A\u0631",
|
|
6982
|
+
paragraph: "\u0641\u0642\u0631\u0629",
|
|
6983
|
+
list: "\u0642\u0627\u0626\u0645\u0629",
|
|
6984
|
+
table: "\u062C\u062F\u0648\u0644",
|
|
6985
|
+
image: "\u0635\u0648\u0631\u0629",
|
|
6986
|
+
raw: "\u062E\u0627\u0645",
|
|
6987
|
+
openBlock: "\u0641\u062A\u062D \u0627\u0644\u0643\u062A\u0644\u0629",
|
|
6988
|
+
collapseBlock: "\u0637\u064A \u0627\u0644\u0643\u062A\u0644\u0629",
|
|
6989
|
+
moveUp: "\u0646\u0642\u0644 \u0644\u0623\u0639\u0644\u0649",
|
|
6990
|
+
moveDown: "\u0646\u0642\u0644 \u0644\u0623\u0633\u0641\u0644",
|
|
6991
|
+
deleteBlock: "\u062D\u0630\u0641 \u0627\u0644\u0643\u062A\u0644\u0629",
|
|
6992
|
+
item: "\u0639\u0646\u0635\u0631",
|
|
6993
|
+
deleteItem: "\u062D\u0630\u0641 \u0627\u0644\u0639\u0646\u0635\u0631",
|
|
6994
|
+
addItem: "\u0639\u0646\u0635\u0631",
|
|
6995
|
+
imagePath: "\u0645\u0633\u0627\u0631 \u0627\u0644\u0645\u0644\u0641 (\\includegraphics)",
|
|
6996
|
+
imagePathLabel: "\u0645\u0633\u0627\u0631 \u0627\u0644\u0635\u0648\u0631\u0629",
|
|
6997
|
+
loadDocumentError: "\u062A\u0639\u0630\u0631 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u062A\u0646\u062F",
|
|
6998
|
+
importOrderMismatch: "\u062A\u0631\u062A\u064A\u0628 \u0623\u0648 \u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0645\u062D\u062F\u062F\u0627\u062A \u0641\u064A math_objects \u0644\u0627 \u062A\u0637\u0627\u0628\u0642 \u0645\u0627 \u0648\u0631\u062F \u0641\u064A \u0627\u0644\u0646\u0635.",
|
|
6999
|
+
importCountMismatch: "\u0639\u062F\u0645 \u062A\u0637\u0627\u0628\u0642 \u0628\u064A\u0646 \u0627\u0644\u0645\u0648\u0627\u0636\u0639 \u0627\u0644\u0631\u064A\u0627\u0636\u064A\u0629 \u0627\u0644\u0645\u0633\u062A\u062E\u0631\u062C\u0629 \u0645\u0646 \u0627\u0644\u0646\u0635 \u0648\u0639\u062F\u062F \u0639\u0646\u0627\u0635\u0631 math_objects.",
|
|
7000
|
+
importWarning: "\u062A\u0646\u0628\u064A\u0647 \u0627\u0644\u0627\u0633\u062A\u064A\u0631\u0627\u062F",
|
|
7001
|
+
path: "\u0627\u0644\u0645\u0633\u0627\u0631",
|
|
7002
|
+
sectionGlyph: "\u0642",
|
|
7003
|
+
subsectionGlyph: "\u0641",
|
|
7004
|
+
subsubsectionGlyph: "\u0635",
|
|
7005
|
+
paragraphGlyph: "\u0623\u0628\u062C"
|
|
7006
|
+
},
|
|
7007
|
+
en: {
|
|
7008
|
+
undoRedo: "Undo and redo",
|
|
7009
|
+
undo: "Undo",
|
|
7010
|
+
redo: "Redo",
|
|
7011
|
+
structure: "Structure",
|
|
7012
|
+
content: "Content",
|
|
7013
|
+
addSection: "Add section",
|
|
7014
|
+
addSubsection: "Add subsection",
|
|
7015
|
+
addSubsubsection: "Add subsubsection",
|
|
7016
|
+
addParagraph: "Add paragraph",
|
|
7017
|
+
inlineEquation: "Inline equation",
|
|
7018
|
+
displayEquation: "Display equation",
|
|
7019
|
+
bulletedList: "Bulleted list",
|
|
7020
|
+
numberedList: "Numbered list",
|
|
7021
|
+
insertImage: "Insert image",
|
|
7022
|
+
insertTable: "Insert table",
|
|
7023
|
+
tableSize: "Table size",
|
|
7024
|
+
rows: "Rows",
|
|
7025
|
+
columns: "Columns",
|
|
7026
|
+
insert: "Insert",
|
|
7027
|
+
panels: "Panels",
|
|
7028
|
+
hideEditor: "Hide editor",
|
|
7029
|
+
editor: "Editor",
|
|
7030
|
+
hidePreview: "Hide preview",
|
|
7031
|
+
preview: "Preview",
|
|
7032
|
+
collapseBlocks: "Collapse blocks",
|
|
7033
|
+
collapseAll: "Collapse all",
|
|
7034
|
+
openAll: "Open all",
|
|
7035
|
+
documentEditor: "Document editor",
|
|
7036
|
+
documentPreview: "Document preview",
|
|
7037
|
+
importWarnings: "Import warnings (development mode)",
|
|
7038
|
+
emptyDocument: "The document is empty",
|
|
7039
|
+
text: "Text",
|
|
7040
|
+
editEquation: "Edit equation",
|
|
7041
|
+
rawEquation: "Raw equation",
|
|
7042
|
+
deleteEquation: "Delete equation",
|
|
7043
|
+
equationUnavailable: "This equation is not currently available for editing",
|
|
7044
|
+
closeEquationDialog: "Close equation dialog",
|
|
7045
|
+
equationEditorTitle: "Edit equation",
|
|
7046
|
+
close: "Close",
|
|
7047
|
+
equationType: "Equation type",
|
|
7048
|
+
inline: "Inline",
|
|
7049
|
+
displayed: "Displayed",
|
|
7050
|
+
saveEquation: "Save equation",
|
|
7051
|
+
section: "Section",
|
|
7052
|
+
subsection: "Subsection",
|
|
7053
|
+
subsubsection: "Subsubsection",
|
|
7054
|
+
paragraph: "Paragraph",
|
|
7055
|
+
list: "List",
|
|
7056
|
+
table: "Table",
|
|
7057
|
+
image: "Image",
|
|
7058
|
+
raw: "Raw",
|
|
7059
|
+
openBlock: "Open block",
|
|
7060
|
+
collapseBlock: "Collapse block",
|
|
7061
|
+
moveUp: "Move up",
|
|
7062
|
+
moveDown: "Move down",
|
|
7063
|
+
deleteBlock: "Delete block",
|
|
7064
|
+
item: "Item",
|
|
7065
|
+
deleteItem: "Delete item",
|
|
7066
|
+
addItem: "Item",
|
|
7067
|
+
imagePath: "File path (\\includegraphics)",
|
|
7068
|
+
imagePathLabel: "Image path",
|
|
7069
|
+
loadDocumentError: "Could not load document",
|
|
7070
|
+
importOrderMismatch: "The math_objects delimiter order or types do not match the document text.",
|
|
7071
|
+
importCountMismatch: "The detected math positions do not match the number of math_objects entries.",
|
|
7072
|
+
importWarning: "Import warning",
|
|
7073
|
+
path: "Path",
|
|
7074
|
+
sectionGlyph: "H1",
|
|
7075
|
+
subsectionGlyph: "H2",
|
|
7076
|
+
subsubsectionGlyph: "H3",
|
|
7077
|
+
paragraphGlyph: "P"
|
|
7078
|
+
}
|
|
7079
|
+
};
|
|
7080
|
+
function document2Messages(locale) {
|
|
7081
|
+
return DOCUMENT2_MESSAGES[locale];
|
|
7082
|
+
}
|
|
7083
|
+
|
|
6519
7084
|
// src/react-document2/MathChip.tsx
|
|
6520
7085
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
6521
7086
|
function MathChip({
|
|
6522
7087
|
token,
|
|
6523
7088
|
output = "svg",
|
|
7089
|
+
documentDirection = "rtl",
|
|
7090
|
+
equationSide = "arabic",
|
|
7091
|
+
editable = true,
|
|
7092
|
+
uiLocale = "ar",
|
|
6524
7093
|
buttonRef,
|
|
6525
7094
|
onOpen,
|
|
6526
7095
|
onDelete,
|
|
@@ -6528,7 +7097,14 @@ function MathChip({
|
|
|
6528
7097
|
onRequestTextFocus,
|
|
6529
7098
|
onTextInputFromFocus
|
|
6530
7099
|
}) {
|
|
6531
|
-
const
|
|
7100
|
+
const messages = document2Messages(uiLocale);
|
|
7101
|
+
const tex = mathTokenSourceForSide(token, equationSide);
|
|
7102
|
+
const forwardArrowKey = documentDirection === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
7103
|
+
const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
7104
|
+
const island = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MathIsland, { id: token.id, tex, display: token.display, output });
|
|
7105
|
+
if (!editable) {
|
|
7106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "butex-document2-widget__math-chip-wrap", "data-display": token.display ? "true" : "false", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "butex-document2-widget__math-chip", "data-editable": "false", "data-display": token.display ? "true" : "false", children: island }) });
|
|
7107
|
+
}
|
|
6532
7108
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "butex-document2-widget__math-chip-wrap", "data-display": token.display ? "true" : "false", children: [
|
|
6533
7109
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
6534
7110
|
"button",
|
|
@@ -6540,7 +7116,7 @@ function MathChip({
|
|
|
6540
7116
|
"data-source-owner": token.sourceOwner,
|
|
6541
7117
|
"data-math-token-id": token.id,
|
|
6542
7118
|
ref: buttonRef,
|
|
6543
|
-
title: token.editable ?
|
|
7119
|
+
title: token.editable ? messages.editEquation : messages.rawEquation,
|
|
6544
7120
|
onClick: () => onOpen(token),
|
|
6545
7121
|
onFocus: () => onFocus?.(token.id),
|
|
6546
7122
|
onKeyDown: (event) => {
|
|
@@ -6549,12 +7125,12 @@ function MathChip({
|
|
|
6549
7125
|
onOpen(token);
|
|
6550
7126
|
return;
|
|
6551
7127
|
}
|
|
6552
|
-
if (event.key ===
|
|
7128
|
+
if (event.key === forwardArrowKey) {
|
|
6553
7129
|
event.preventDefault();
|
|
6554
7130
|
onRequestTextFocus?.(token.id, 1);
|
|
6555
7131
|
return;
|
|
6556
7132
|
}
|
|
6557
|
-
if (event.key ===
|
|
7133
|
+
if (event.key === backwardArrowKey) {
|
|
6558
7134
|
event.preventDefault();
|
|
6559
7135
|
onRequestTextFocus?.(token.id, -1);
|
|
6560
7136
|
return;
|
|
@@ -6569,7 +7145,7 @@ function MathChip({
|
|
|
6569
7145
|
onTextInputFromFocus?.(token.id, event.key);
|
|
6570
7146
|
}
|
|
6571
7147
|
},
|
|
6572
|
-
children:
|
|
7148
|
+
children: island
|
|
6573
7149
|
}
|
|
6574
7150
|
),
|
|
6575
7151
|
onDelete ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -6577,8 +7153,8 @@ function MathChip({
|
|
|
6577
7153
|
{
|
|
6578
7154
|
type: "button",
|
|
6579
7155
|
className: "butex-document2-widget__math-chip-delete",
|
|
6580
|
-
title:
|
|
6581
|
-
"aria-label":
|
|
7156
|
+
title: messages.deleteEquation,
|
|
7157
|
+
"aria-label": messages.deleteEquation,
|
|
6582
7158
|
onClick: (event) => {
|
|
6583
7159
|
event.stopPropagation();
|
|
6584
7160
|
onDelete(token.id);
|
|
@@ -6609,7 +7185,11 @@ function fitTextareaHeight(element) {
|
|
|
6609
7185
|
function InlineField({
|
|
6610
7186
|
field,
|
|
6611
7187
|
blockId,
|
|
7188
|
+
documentDirection = "rtl",
|
|
6612
7189
|
mathOutput = "svg",
|
|
7190
|
+
equationSide = "arabic",
|
|
7191
|
+
editableEquations = true,
|
|
7192
|
+
uiLocale = "ar",
|
|
6613
7193
|
onTextChange,
|
|
6614
7194
|
onOpenMath,
|
|
6615
7195
|
onDeleteMath,
|
|
@@ -6617,6 +7197,7 @@ function InlineField({
|
|
|
6617
7197
|
onMathFocus,
|
|
6618
7198
|
onFieldBlur
|
|
6619
7199
|
}) {
|
|
7200
|
+
const messages = document2Messages(uiLocale);
|
|
6620
7201
|
const textRefs = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
|
|
6621
7202
|
const mathRefs = (0, import_react2.useRef)(/* @__PURE__ */ new Map());
|
|
6622
7203
|
function textTokenOffset(tokenId, fallback) {
|
|
@@ -6680,14 +7261,16 @@ function InlineField({
|
|
|
6680
7261
|
onTextChange(field.id, textTokenId, nextText);
|
|
6681
7262
|
focusTextToken(textTokenId, insertAtStart ? text.length : nextText.length);
|
|
6682
7263
|
}
|
|
6683
|
-
|
|
7264
|
+
const forwardArrowKey = documentDirection === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
7265
|
+
const backwardArrowKey = documentDirection === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
7266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "butex-document2-widget__inline-field", dir: documentDirection, "data-document-direction": documentDirection, children: field.tokens.map(
|
|
6684
7267
|
(token) => token.kind === "text" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
6685
7268
|
"textarea",
|
|
6686
7269
|
{
|
|
6687
7270
|
className: "butex-document2-widget__inline-text",
|
|
6688
7271
|
value: token.text,
|
|
6689
|
-
dir:
|
|
6690
|
-
"aria-label":
|
|
7272
|
+
dir: documentDirection,
|
|
7273
|
+
"aria-label": messages.text,
|
|
6691
7274
|
rows: 1,
|
|
6692
7275
|
"data-field-id": field.id,
|
|
6693
7276
|
"data-text-token-id": token.id,
|
|
@@ -6709,13 +7292,13 @@ function InlineField({
|
|
|
6709
7292
|
if (!collapsed) {
|
|
6710
7293
|
return;
|
|
6711
7294
|
}
|
|
6712
|
-
if (event.key ===
|
|
7295
|
+
if (editableEquations && event.key === forwardArrowKey && element.selectionStart === element.value.length) {
|
|
6713
7296
|
const nextMathId = adjacentTokenId(token.id, 1, "math");
|
|
6714
7297
|
if (nextMathId) {
|
|
6715
7298
|
event.preventDefault();
|
|
6716
7299
|
focusMathToken(nextMathId);
|
|
6717
7300
|
}
|
|
6718
|
-
} else if (event.key ===
|
|
7301
|
+
} else if (editableEquations && event.key === backwardArrowKey && element.selectionStart === 0) {
|
|
6719
7302
|
const previousMathId = adjacentTokenId(token.id, -1, "math");
|
|
6720
7303
|
if (previousMathId) {
|
|
6721
7304
|
event.preventDefault();
|
|
@@ -6738,6 +7321,9 @@ function InlineField({
|
|
|
6738
7321
|
{
|
|
6739
7322
|
token,
|
|
6740
7323
|
output: mathOutput,
|
|
7324
|
+
equationSide,
|
|
7325
|
+
editable: editableEquations,
|
|
7326
|
+
uiLocale,
|
|
6741
7327
|
buttonRef: (element) => {
|
|
6742
7328
|
if (element) {
|
|
6743
7329
|
mathRefs.current.set(token.id, element);
|
|
@@ -6747,6 +7333,7 @@ function InlineField({
|
|
|
6747
7333
|
},
|
|
6748
7334
|
onOpen: onOpenMath,
|
|
6749
7335
|
onDelete: onDeleteMath,
|
|
7336
|
+
documentDirection,
|
|
6750
7337
|
onFocus: (tokenId) => {
|
|
6751
7338
|
if (blockId && onMathFocus) {
|
|
6752
7339
|
onMathFocus(blockId, field.id, tokenId);
|
|
@@ -6787,29 +7374,29 @@ function blockChromeClass(block) {
|
|
|
6787
7374
|
}
|
|
6788
7375
|
return `${root} ${root}--raw`;
|
|
6789
7376
|
}
|
|
6790
|
-
function blockLabel(block) {
|
|
7377
|
+
function blockLabel(block, messages) {
|
|
6791
7378
|
if (block.kind === "textBlock") {
|
|
6792
7379
|
if (block.command === "\\section") {
|
|
6793
|
-
return
|
|
7380
|
+
return messages.section;
|
|
6794
7381
|
}
|
|
6795
7382
|
if (block.command === "\\subsection") {
|
|
6796
|
-
return
|
|
7383
|
+
return messages.subsection;
|
|
6797
7384
|
}
|
|
6798
7385
|
if (block.command === "\\subsubsection") {
|
|
6799
|
-
return
|
|
7386
|
+
return messages.subsubsection;
|
|
6800
7387
|
}
|
|
6801
|
-
return
|
|
7388
|
+
return messages.paragraph;
|
|
6802
7389
|
}
|
|
6803
7390
|
if (block.kind === "list") {
|
|
6804
|
-
return block.command === "\\begin{enumerate}" ?
|
|
7391
|
+
return block.command === "\\begin{enumerate}" ? messages.numberedList : messages.list;
|
|
6805
7392
|
}
|
|
6806
7393
|
if (block.kind === "table") {
|
|
6807
|
-
return
|
|
7394
|
+
return messages.table;
|
|
6808
7395
|
}
|
|
6809
7396
|
if (block.kind === "image") {
|
|
6810
|
-
return
|
|
7397
|
+
return messages.image;
|
|
6811
7398
|
}
|
|
6812
|
-
return
|
|
7399
|
+
return messages.raw;
|
|
6813
7400
|
}
|
|
6814
7401
|
function truncateSummary(value) {
|
|
6815
7402
|
const normalized = value.replace(/\s+/g, " ").trim();
|
|
@@ -6846,7 +7433,11 @@ function BlockEditor({
|
|
|
6846
7433
|
depth = 0,
|
|
6847
7434
|
blockIndex = 0,
|
|
6848
7435
|
blockCount = 1,
|
|
7436
|
+
documentDirection = "rtl",
|
|
6849
7437
|
mathOutput = "svg",
|
|
7438
|
+
equationSide = "arabic",
|
|
7439
|
+
editableEquations = true,
|
|
7440
|
+
uiLocale = "ar",
|
|
6850
7441
|
isCollapsed = false,
|
|
6851
7442
|
onTextChange,
|
|
6852
7443
|
onOpenMath,
|
|
@@ -6862,11 +7453,16 @@ function BlockEditor({
|
|
|
6862
7453
|
onAddListItem,
|
|
6863
7454
|
onRemoveListItem
|
|
6864
7455
|
}) {
|
|
7456
|
+
const messages = document2Messages(uiLocale);
|
|
6865
7457
|
const showChrome = depth === 0;
|
|
6866
7458
|
const chromeClass = [blockChromeClass(block), isCollapsed ? "butex-document2-widget__block--collapsed" : ""].filter(Boolean).join(" ");
|
|
6867
7459
|
const fieldProps = {
|
|
6868
7460
|
blockId: block.id,
|
|
7461
|
+
documentDirection,
|
|
6869
7462
|
mathOutput,
|
|
7463
|
+
equationSide,
|
|
7464
|
+
editableEquations,
|
|
7465
|
+
uiLocale,
|
|
6870
7466
|
onTextChange,
|
|
6871
7467
|
onOpenMath,
|
|
6872
7468
|
onDeleteMath,
|
|
@@ -6882,7 +7478,7 @@ function BlockEditor({
|
|
|
6882
7478
|
type: "button",
|
|
6883
7479
|
className: "butex-document2-widget__block-collapse",
|
|
6884
7480
|
"aria-expanded": !isCollapsed,
|
|
6885
|
-
title: isCollapsed ?
|
|
7481
|
+
title: isCollapsed ? messages.openBlock : messages.collapseBlock,
|
|
6886
7482
|
onClick: (event) => {
|
|
6887
7483
|
event.stopPropagation();
|
|
6888
7484
|
onToggleCollapse(block.id);
|
|
@@ -6890,14 +7486,14 @@ function BlockEditor({
|
|
|
6890
7486
|
children: isCollapsed ? "+" : "-"
|
|
6891
7487
|
}
|
|
6892
7488
|
) : null,
|
|
6893
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: blockLabel(block) })
|
|
7489
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: blockLabel(block, messages) })
|
|
6894
7490
|
] }),
|
|
6895
7491
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "butex-document2-widget__block-actions", children: [
|
|
6896
7492
|
onMoveBlock ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
6897
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title:
|
|
6898
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title:
|
|
7493
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: messages.moveUp, "aria-label": messages.moveUp, disabled: blockIndex <= 0, onClick: () => onMoveBlock(block.id, -1), children: "\u2191" }),
|
|
7494
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: messages.moveDown, "aria-label": messages.moveDown, disabled: blockIndex >= blockCount - 1, onClick: () => onMoveBlock(block.id, 1), children: "\u2193" })
|
|
6899
7495
|
] }) : null,
|
|
6900
|
-
onRemoveBlock ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveBlock(block.id), children:
|
|
7496
|
+
onRemoveBlock ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveBlock(block.id), children: messages.deleteBlock }) : null
|
|
6901
7497
|
] })
|
|
6902
7498
|
] }) : null;
|
|
6903
7499
|
if (isCollapsed && showChrome) {
|
|
@@ -6915,43 +7511,52 @@ function BlockEditor({
|
|
|
6915
7511
|
if (block.kind === "list") {
|
|
6916
7512
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: chromeClass, children: [
|
|
6917
7513
|
header,
|
|
6918
|
-
block.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "butex-document2-widget__field", children: [
|
|
6919
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "butex-document2-widget__toolbar-label", children: block.command === "\\begin{enumerate}" ?
|
|
6920
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
7514
|
+
block.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "butex-document2-widget__field", dir: "rtl", children: [
|
|
7515
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "butex-document2-widget__toolbar-label", children: block.command === "\\begin{enumerate}" ? `${messages.item} ${String(index + 1)}` : messages.item }),
|
|
7516
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "butex-document2-widget__list-item-content", dir: documentDirection, children: [
|
|
7517
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InlineField, { field: item.field, ...fieldProps }),
|
|
7518
|
+
item.blocks.map((child) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
7519
|
+
BlockEditor,
|
|
7520
|
+
{
|
|
7521
|
+
block: child,
|
|
7522
|
+
depth: depth + 1,
|
|
7523
|
+
documentDirection,
|
|
7524
|
+
mathOutput,
|
|
7525
|
+
equationSide,
|
|
7526
|
+
editableEquations,
|
|
7527
|
+
uiLocale,
|
|
7528
|
+
onTextChange,
|
|
7529
|
+
onOpenMath,
|
|
7530
|
+
onDeleteMath,
|
|
7531
|
+
onFieldFocus,
|
|
7532
|
+
onMathFocus,
|
|
7533
|
+
onFieldBlur,
|
|
7534
|
+
onImageSrcChange,
|
|
7535
|
+
onAddListItem,
|
|
7536
|
+
onRemoveListItem
|
|
7537
|
+
},
|
|
7538
|
+
child.id
|
|
7539
|
+
))
|
|
7540
|
+
] }),
|
|
7541
|
+
onRemoveListItem && block.items.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "butex-document2-widget__list-item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: () => onRemoveListItem(block.id, item.id), children: messages.deleteItem }) }) : null
|
|
6940
7542
|
] }, item.id)),
|
|
6941
|
-
onAddListItem ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */ (0, import_jsx_runtime4.
|
|
7543
|
+
onAddListItem ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "butex-document2-widget__list-footer", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", onClick: () => onAddListItem(block.id), children: [
|
|
7544
|
+
"+ ",
|
|
7545
|
+
messages.addItem
|
|
7546
|
+
] }) }) : null
|
|
6942
7547
|
] });
|
|
6943
7548
|
}
|
|
6944
7549
|
if (block.kind === "table") {
|
|
6945
7550
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: chromeClass, children: [
|
|
6946
7551
|
header,
|
|
6947
|
-
block.rows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "butex-document2-widget__row", children: row.map((cell) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "butex-document2-widget__table-cell", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InlineField, { field: cell, ...fieldProps }) }, cell.id)) }, rowIndex))
|
|
7552
|
+
block.rows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "butex-document2-widget__row", dir: documentDirection, children: row.map((cell) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "butex-document2-widget__table-cell", dir: documentDirection, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InlineField, { field: cell, ...fieldProps }) }, cell.id)) }, rowIndex))
|
|
6948
7553
|
] });
|
|
6949
7554
|
}
|
|
6950
7555
|
if (block.kind === "image") {
|
|
6951
7556
|
const imageFieldId = `butex-d2-img-${block.id}`;
|
|
6952
7557
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: chromeClass, children: [
|
|
6953
7558
|
header,
|
|
6954
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "butex-document2-widget__image-src-label", htmlFor: imageFieldId, children:
|
|
7559
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "butex-document2-widget__image-src-label", htmlFor: imageFieldId, children: messages.imagePath }),
|
|
6955
7560
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
6956
7561
|
"textarea",
|
|
6957
7562
|
{
|
|
@@ -6959,7 +7564,7 @@ function BlockEditor({
|
|
|
6959
7564
|
className: "butex-document2-widget__inline-text",
|
|
6960
7565
|
value: block.value,
|
|
6961
7566
|
dir: "ltr",
|
|
6962
|
-
"aria-label":
|
|
7567
|
+
"aria-label": messages.imagePathLabel,
|
|
6963
7568
|
rows: 1,
|
|
6964
7569
|
ref: (element) => {
|
|
6965
7570
|
if (element) {
|
|
@@ -6986,7 +7591,8 @@ function BlockEditor({
|
|
|
6986
7591
|
// src/react-document2/TableInsertPopover.tsx
|
|
6987
7592
|
var import_react3 = require("react");
|
|
6988
7593
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
6989
|
-
function TableInsertPopover({ onConfirm }) {
|
|
7594
|
+
function TableInsertPopover({ uiLocale = "ar", onConfirm }) {
|
|
7595
|
+
const messages = document2Messages(uiLocale);
|
|
6990
7596
|
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
6991
7597
|
const [rows, setRows] = (0, import_react3.useState)("3");
|
|
6992
7598
|
const [cols, setCols] = (0, import_react3.useState)("3");
|
|
@@ -7015,24 +7621,24 @@ function TableInsertPopover({ onConfirm }) {
|
|
|
7015
7621
|
{
|
|
7016
7622
|
type: "button",
|
|
7017
7623
|
className: "butex-document2-widget__icon-btn",
|
|
7018
|
-
title:
|
|
7019
|
-
"aria-label":
|
|
7624
|
+
title: messages.insertTable,
|
|
7625
|
+
"aria-label": messages.insertTable,
|
|
7020
7626
|
"aria-haspopup": "dialog",
|
|
7021
7627
|
"aria-expanded": open,
|
|
7022
7628
|
onClick: () => setOpen((value) => !value),
|
|
7023
7629
|
children: "\u229E"
|
|
7024
7630
|
}
|
|
7025
7631
|
),
|
|
7026
|
-
open ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "butex-document2-widget__table-popover-panel", role: "dialog", "aria-label":
|
|
7632
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "butex-document2-widget__table-popover-panel", role: "dialog", "aria-label": messages.tableSize, children: [
|
|
7027
7633
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
7028
|
-
|
|
7634
|
+
messages.rows,
|
|
7029
7635
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "number", min: 1, max: 20, value: rows, onChange: (event) => setRows(event.currentTarget.value) })
|
|
7030
7636
|
] }),
|
|
7031
7637
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { children: [
|
|
7032
|
-
|
|
7638
|
+
messages.columns,
|
|
7033
7639
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { type: "number", min: 1, max: 10, value: cols, onChange: (event) => setCols(event.currentTarget.value) })
|
|
7034
7640
|
] }),
|
|
7035
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", onClick: confirm, children:
|
|
7641
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", onClick: confirm, children: messages.insert })
|
|
7036
7642
|
] }) : null
|
|
7037
7643
|
] });
|
|
7038
7644
|
}
|
|
@@ -7042,6 +7648,8 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
|
7042
7648
|
function DocumentInsertToolbar({
|
|
7043
7649
|
canUndo,
|
|
7044
7650
|
canRedo,
|
|
7651
|
+
editableEquations = true,
|
|
7652
|
+
uiLocale = "ar",
|
|
7045
7653
|
onUndo,
|
|
7046
7654
|
onRedo,
|
|
7047
7655
|
onAddSection,
|
|
@@ -7055,24 +7663,25 @@ function DocumentInsertToolbar({
|
|
|
7055
7663
|
onAddEnumerate,
|
|
7056
7664
|
onAddFigure
|
|
7057
7665
|
}) {
|
|
7666
|
+
const messages = document2Messages(uiLocale);
|
|
7058
7667
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "butex-document2-widget__toolbar-insert", children: [
|
|
7059
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label":
|
|
7060
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7061
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7668
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.undoRedo, children: [
|
|
7669
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.undo} (Ctrl+Z)`, "aria-label": messages.undo, disabled: !canUndo, onClick: onUndo, children: "\u21B6" }),
|
|
7670
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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" })
|
|
7062
7671
|
] }),
|
|
7063
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label":
|
|
7064
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h1", title:
|
|
7065
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h2", title:
|
|
7066
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h3", title:
|
|
7067
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7672
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.structure, children: [
|
|
7673
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h1", title: messages.addSection, "aria-label": messages.addSection, onClick: onAddSection, children: messages.sectionGlyph }),
|
|
7674
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn butex-document2-widget__icon-btn--h2", title: messages.addSubsection, "aria-label": messages.addSubsection, onClick: onAddSubsection, children: messages.subsectionGlyph }),
|
|
7675
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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 }),
|
|
7676
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.addParagraph, "aria-label": messages.addParagraph, onClick: onAddParagraph, children: messages.paragraphGlyph })
|
|
7068
7677
|
] }),
|
|
7069
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label":
|
|
7070
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7071
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7072
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TableInsertPopover, { onConfirm: onAddTable }),
|
|
7073
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7074
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7075
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title:
|
|
7678
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.content, children: [
|
|
7679
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.inlineEquation} ($\u2026$)`, "aria-label": messages.inlineEquation, disabled: !editableEquations, onClick: onAddInlineEquation, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "butex-document2-widget__icon-math-inline", "aria-hidden": "true", children: "$=$" }) }),
|
|
7680
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title: `${messages.displayEquation} (\\[\u2026\\])`, "aria-label": messages.displayEquation, disabled: !editableEquations, onClick: onAddDisplayEquation, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "butex-document2-widget__icon-math-display", "aria-hidden": "true", children: "\\[\xF7\\]" }) }),
|
|
7681
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TableInsertPopover, { uiLocale, onConfirm: onAddTable }),
|
|
7682
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.bulletedList, "aria-label": messages.bulletedList, onClick: onAddList, children: "\u2022\u2261" }),
|
|
7683
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.numberedList, "aria-label": messages.numberedList, onClick: onAddEnumerate, children: "1." }),
|
|
7684
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "butex-document2-widget__icon-btn", title: messages.insertImage, "aria-label": messages.insertImage, onClick: onAddFigure, children: "\u{1F5BC}" })
|
|
7076
7685
|
] })
|
|
7077
7686
|
] });
|
|
7078
7687
|
}
|
|
@@ -7110,8 +7719,14 @@ function PreviewBlock({ block, output }) {
|
|
|
7110
7719
|
}
|
|
7111
7720
|
return null;
|
|
7112
7721
|
}
|
|
7113
|
-
function DocumentPreview({
|
|
7114
|
-
|
|
7722
|
+
function DocumentPreview({
|
|
7723
|
+
blocks,
|
|
7724
|
+
output,
|
|
7725
|
+
documentDirection = "rtl",
|
|
7726
|
+
uiLocale = "ar"
|
|
7727
|
+
}) {
|
|
7728
|
+
const messages = document2Messages(uiLocale);
|
|
7729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "butex-document2-widget__preview", dir: documentDirection, children: blocks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: messages.emptyDocument }) : blocks.map((block) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PreviewBlock, { block, output }, block.id)) });
|
|
7115
7730
|
}
|
|
7116
7731
|
|
|
7117
7732
|
// src/react-document2/EquationDrawer.tsx
|
|
@@ -8045,18 +8660,23 @@ function injectWidgetChromeCss(doc) {
|
|
|
8045
8660
|
d.head.appendChild(style);
|
|
8046
8661
|
}
|
|
8047
8662
|
|
|
8663
|
+
// src/uiLocale.ts
|
|
8664
|
+
function uiLocaleDirection(locale) {
|
|
8665
|
+
return locale === "ar" ? "rtl" : "ltr";
|
|
8666
|
+
}
|
|
8667
|
+
|
|
8048
8668
|
// src/react/ButexEditor.tsx
|
|
8049
8669
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
8050
8670
|
var DIGIT_FORM_OPTIONS = [
|
|
8051
|
-
{ id: "western", label: "456"
|
|
8052
|
-
{ id: "arabicIndic", label: "\u0664\u0665\u0666"
|
|
8053
|
-
{ id: "persianIndic", label: "\u06F4\u06F5\u06F6"
|
|
8671
|
+
{ id: "western", label: "456" },
|
|
8672
|
+
{ id: "arabicIndic", label: "\u0664\u0665\u0666" },
|
|
8673
|
+
{ id: "persianIndic", label: "\u06F4\u06F5\u06F6" }
|
|
8054
8674
|
];
|
|
8055
8675
|
var CHARACTER_FONT_OPTIONS = [
|
|
8056
|
-
{ id: "default", label: "\u0633"
|
|
8057
|
-
{ id: "takween", label: "\u062A\u0643"
|
|
8058
|
-
{ id: "diwani", label: "\u062F\u064A\u0648"
|
|
8059
|
-
{ id: "diwaniOutline", label: "\u0638\u0644"
|
|
8676
|
+
{ id: "default", label: "\u0633" },
|
|
8677
|
+
{ id: "takween", label: "\u062A\u0643" },
|
|
8678
|
+
{ id: "diwani", label: "\u062F\u064A\u0648" },
|
|
8679
|
+
{ id: "diwaniOutline", label: "\u0638\u0644" }
|
|
8060
8680
|
];
|
|
8061
8681
|
var FUNCTION_COMMANDS = atomicCommandsByCategory("function");
|
|
8062
8682
|
var LIMITS_SERIES_COMMANDS = atomicCommandsByCategory("limits_series");
|
|
@@ -8069,20 +8689,20 @@ var OPERATOR3_COMMANDS = atomicOperatorCommandsByCategory("operators3");
|
|
|
8069
8689
|
var DOT_COMMANDS = atomicOperatorCommandsByCategory("dots");
|
|
8070
8690
|
var INTEGRAL_COMMANDS = atomicOperatorCommandsByCategory("integrals");
|
|
8071
8691
|
var MATRIX_STYLES = [
|
|
8072
|
-
{ id: "matrix", label: "\u25A1"
|
|
8073
|
-
{ id: "pmatrix", label: "(\u25A1)"
|
|
8074
|
-
{ id: "bmatrix", label: "[\u25A1]"
|
|
8075
|
-
{ id: "Bmatrix", label: "{\u25A1}"
|
|
8076
|
-
{ id: "vmatrix", label: "|\u25A1|"
|
|
8077
|
-
{ id: "Vmatrix", label: "||\u25A1||"
|
|
8692
|
+
{ id: "matrix", label: "\u25A1" },
|
|
8693
|
+
{ id: "pmatrix", label: "(\u25A1)" },
|
|
8694
|
+
{ id: "bmatrix", label: "[\u25A1]" },
|
|
8695
|
+
{ id: "Bmatrix", label: "{\u25A1}" },
|
|
8696
|
+
{ id: "vmatrix", label: "|\u25A1|" },
|
|
8697
|
+
{ id: "Vmatrix", label: "||\u25A1||" }
|
|
8078
8698
|
];
|
|
8079
8699
|
var ARRAY_ALIGNMENTS = [
|
|
8080
|
-
{ id: "l"
|
|
8081
|
-
{ id: "c"
|
|
8082
|
-
{ id: "r"
|
|
8700
|
+
{ id: "l" },
|
|
8701
|
+
{ id: "c" },
|
|
8702
|
+
{ id: "r" }
|
|
8083
8703
|
];
|
|
8084
|
-
function matrixSizeLabel(rows, columns) {
|
|
8085
|
-
return `${String(rows)}
|
|
8704
|
+
function matrixSizeLabel(rows, columns, messages) {
|
|
8705
|
+
return `${String(rows)} ${messages.row} \xD7 ${String(columns)} ${messages.column}`;
|
|
8086
8706
|
}
|
|
8087
8707
|
function clampMatrixSize(value) {
|
|
8088
8708
|
return Math.max(1, Math.min(12, Math.trunc(value)));
|
|
@@ -8093,6 +8713,30 @@ function digitFormLabel(digitForm) {
|
|
|
8093
8713
|
function characterFontOption(fontId) {
|
|
8094
8714
|
return CHARACTER_FONT_OPTIONS.find((option) => option.id === fontId) ?? CHARACTER_FONT_OPTIONS[0];
|
|
8095
8715
|
}
|
|
8716
|
+
function characterFontTitle(fontId, messages) {
|
|
8717
|
+
if (fontId === "takween") return messages.takweenFont;
|
|
8718
|
+
if (fontId === "diwani") return messages.diwaniFont;
|
|
8719
|
+
if (fontId === "diwaniOutline") return messages.diwaniOutlineFont;
|
|
8720
|
+
return messages.defaultFont;
|
|
8721
|
+
}
|
|
8722
|
+
function digitFormTitle(digitForm, messages) {
|
|
8723
|
+
if (digitForm === "arabicIndic") return messages.arabicIndicDigits;
|
|
8724
|
+
if (digitForm === "persianIndic") return messages.persianIndicDigits;
|
|
8725
|
+
return messages.westernDigits;
|
|
8726
|
+
}
|
|
8727
|
+
function matrixStyleTitle(style, messages) {
|
|
8728
|
+
if (style === "pmatrix") return messages.matrixParentheses;
|
|
8729
|
+
if (style === "bmatrix") return messages.matrixBrackets;
|
|
8730
|
+
if (style === "Bmatrix") return messages.matrixBraces;
|
|
8731
|
+
if (style === "vmatrix") return messages.matrixBars;
|
|
8732
|
+
if (style === "Vmatrix") return messages.matrixDoubleBars;
|
|
8733
|
+
return messages.matrixNoDelimiters;
|
|
8734
|
+
}
|
|
8735
|
+
function alignmentCopy(alignment, messages) {
|
|
8736
|
+
if (alignment === "l") return { label: messages.alignLeft, title: messages.alignColumnLeft };
|
|
8737
|
+
if (alignment === "r") return { label: messages.alignRight, title: messages.alignColumnRight };
|
|
8738
|
+
return { label: messages.alignCenter, title: messages.alignColumnCenter };
|
|
8739
|
+
}
|
|
8096
8740
|
function spacingArrow(spec, side) {
|
|
8097
8741
|
const pointsWithFlow = spec.spacing.direction === "positive";
|
|
8098
8742
|
if (pointsWithFlow) {
|
|
@@ -8131,16 +8775,17 @@ function renderOperatorMenuButtonLabel(command, fallback) {
|
|
|
8131
8775
|
}
|
|
8132
8776
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: shouldMirrorOperatorDisplay(command) ? "operator-command-label operator-command-label--mirror" : "operator-command-label", children: renderOperatorCommandLabel(command) });
|
|
8133
8777
|
}
|
|
8134
|
-
function passiveTreeText(session) {
|
|
8778
|
+
function passiveTreeText(session, messages) {
|
|
8135
8779
|
const passive = session.activeSide === "arabic" ? session.englishTree : session.arabicTree;
|
|
8136
|
-
const title = session.activeSide === "arabic" ?
|
|
8780
|
+
const title = session.activeSide === "arabic" ? messages.inactiveEnglish : messages.inactiveArabic;
|
|
8137
8781
|
const latex = session.activeSide === "arabic" ? renderChainEnglish(passive) : renderChainArabic(passive);
|
|
8138
8782
|
return `${title}
|
|
8139
8783
|
|
|
8140
|
-
${latex ||
|
|
8784
|
+
${latex || messages.empty}`;
|
|
8141
8785
|
}
|
|
8142
8786
|
var ButexEditor = (0, import_react4.forwardRef)(
|
|
8143
|
-
function ButexEditor2({ className, debug = false, initialSession, onSessionChange }, ref) {
|
|
8787
|
+
function ButexEditor2({ className, debug = false, defaultSide, uiLocale = "ar", initialSession, onSessionChange }, ref) {
|
|
8788
|
+
const messages = equationEditorMessages(uiLocale);
|
|
8144
8789
|
const wrapperRef = (0, import_react4.useRef)(null);
|
|
8145
8790
|
const surfaceRef = (0, import_react4.useRef)(null);
|
|
8146
8791
|
const mathOutputRef = (0, import_react4.useRef)(null);
|
|
@@ -8158,6 +8803,8 @@ var ButexEditor = (0, import_react4.forwardRef)(
|
|
|
8158
8803
|
const runtimeRef = (0, import_react4.useRef)(null);
|
|
8159
8804
|
const debugRef = (0, import_react4.useRef)(debug);
|
|
8160
8805
|
debugRef.current = debug;
|
|
8806
|
+
const uiLocaleRef = (0, import_react4.useRef)(uiLocale);
|
|
8807
|
+
uiLocaleRef.current = uiLocale;
|
|
8161
8808
|
const onSessionChangeRef = (0, import_react4.useRef)(onSessionChange);
|
|
8162
8809
|
onSessionChangeRef.current = onSessionChange;
|
|
8163
8810
|
const debugBodyHiddenRef = (0, import_react4.useRef)(false);
|
|
@@ -8199,14 +8846,15 @@ var ButexEditor = (0, import_react4.forwardRef)(
|
|
|
8199
8846
|
const arabic = renderArabicLatexFromSession(session);
|
|
8200
8847
|
const activeLatex = session.activeSide === "arabic" ? arabic : english;
|
|
8201
8848
|
if (debugRef.current && latexLinesEl) {
|
|
8202
|
-
|
|
8203
|
-
|
|
8849
|
+
const currentMessages = equationEditorMessages(uiLocaleRef.current);
|
|
8850
|
+
latexLinesEl.textContent = `${currentMessages.englishLatex}:
|
|
8851
|
+
${english || currentMessages.empty}
|
|
8204
8852
|
|
|
8205
|
-
|
|
8206
|
-
${arabic ||
|
|
8853
|
+
${currentMessages.arabicLatex}:
|
|
8854
|
+
${arabic || currentMessages.empty}`;
|
|
8207
8855
|
}
|
|
8208
8856
|
if (debugRef.current && passivePreviewEl) {
|
|
8209
|
-
passivePreviewEl.textContent = passiveTreeText(session);
|
|
8857
|
+
passivePreviewEl.textContent = passiveTreeText(session, equationEditorMessages(uiLocaleRef.current));
|
|
8210
8858
|
passivePreviewEl.classList.toggle("passive--ltr", session.activeSide === "arabic");
|
|
8211
8859
|
}
|
|
8212
8860
|
if (debugRef.current && debugLogEl) {
|
|
@@ -8232,7 +8880,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8232
8880
|
} catch (err) {
|
|
8233
8881
|
const message = err instanceof Error ? err.message : String(err);
|
|
8234
8882
|
renderErrorEl.hidden = false;
|
|
8235
|
-
renderErrorEl.textContent =
|
|
8883
|
+
renderErrorEl.textContent = `${equationEditorMessages(uiLocaleRef.current).mathJaxError}: ${message}`;
|
|
8236
8884
|
if (runtimeRef.current) {
|
|
8237
8885
|
runtimeRef.current.setSession(setRenderError(runtimeRef.current.getSession(), message));
|
|
8238
8886
|
}
|
|
@@ -8250,6 +8898,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8250
8898
|
const runtime = createEditorRuntime({
|
|
8251
8899
|
surfaceEl,
|
|
8252
8900
|
initialSession,
|
|
8901
|
+
defaultSide,
|
|
8902
|
+
uiLocale,
|
|
8253
8903
|
buttonElements: {
|
|
8254
8904
|
undoBtn: undoBtnRef.current,
|
|
8255
8905
|
redoBtn: redoBtnRef.current,
|
|
@@ -8269,7 +8919,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8269
8919
|
const el = renderErrorRef.current;
|
|
8270
8920
|
if (el) {
|
|
8271
8921
|
el.hidden = false;
|
|
8272
|
-
el.textContent =
|
|
8922
|
+
el.textContent = `${equationEditorMessages(uiLocaleRef.current).previewError}: ${message}`;
|
|
8273
8923
|
}
|
|
8274
8924
|
});
|
|
8275
8925
|
}
|
|
@@ -8294,6 +8944,13 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8294
8944
|
runtimeRef.current = null;
|
|
8295
8945
|
};
|
|
8296
8946
|
}, []);
|
|
8947
|
+
(0, import_react4.useEffect)(() => {
|
|
8948
|
+
runtimeRef.current?.setUiLocale(uiLocale);
|
|
8949
|
+
const session = runtimeRef.current?.getSession();
|
|
8950
|
+
if (session) {
|
|
8951
|
+
void updatePreviewRef.current(session);
|
|
8952
|
+
}
|
|
8953
|
+
}, [uiLocale]);
|
|
8297
8954
|
function focusSurface() {
|
|
8298
8955
|
surfaceRef.current?.focus();
|
|
8299
8956
|
}
|
|
@@ -8311,26 +8968,26 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8311
8968
|
{
|
|
8312
8969
|
ref: wrapperRef,
|
|
8313
8970
|
className: `butex-widget ${className ?? ""}`.trim(),
|
|
8314
|
-
dir:
|
|
8315
|
-
lang:
|
|
8971
|
+
dir: uiLocaleDirection(uiLocale),
|
|
8972
|
+
lang: uiLocale,
|
|
8316
8973
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "butex-widget-layout", children: [
|
|
8317
8974
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "panel", children: [
|
|
8318
8975
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar", children: [
|
|
8319
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label":
|
|
8320
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title:
|
|
8321
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title:
|
|
8976
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-history", role: "group", "aria-label": messages.undoRedo, children: [
|
|
8977
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: undoBtnRef, id: "btn-undo", type: "button", className: "icon-btn", title: messages.undo, "aria-label": messages.undo, children: "\u21B7" }),
|
|
8978
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: redoBtnRef, id: "btn-redo", type: "button", className: "icon-btn", title: messages.redo, "aria-label": messages.redo, children: "\u21B6" })
|
|
8322
8979
|
] }),
|
|
8323
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label":
|
|
8324
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title:
|
|
8325
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title:
|
|
8980
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-clipboard", role: "group", "aria-label": messages.clipboard, children: [
|
|
8981
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: copyBtnRef, id: "btn-copy", type: "button", className: "icon-btn", title: messages.copy, "aria-label": messages.copy, disabled: true, children: "\u29C9" }),
|
|
8982
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: cutBtnRef, id: "btn-cut", type: "button", className: "icon-btn", title: messages.cut, "aria-label": messages.cut, disabled: true, children: "\u2702" }),
|
|
8326
8983
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8327
8984
|
"button",
|
|
8328
8985
|
{
|
|
8329
8986
|
id: "btn-paste",
|
|
8330
8987
|
type: "button",
|
|
8331
8988
|
className: "icon-btn",
|
|
8332
|
-
title:
|
|
8333
|
-
"aria-label":
|
|
8989
|
+
title: messages.paste,
|
|
8990
|
+
"aria-label": messages.paste,
|
|
8334
8991
|
onClick: () => {
|
|
8335
8992
|
void runtimeRef.current?.performPaste().then(() => {
|
|
8336
8993
|
focusSurface();
|
|
@@ -8340,8 +8997,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8340
8997
|
}
|
|
8341
8998
|
)
|
|
8342
8999
|
] }),
|
|
8343
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label":
|
|
8344
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label":
|
|
9000
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.editorSettings, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn accent", type: "button", title: messages.toggleSide, "aria-label": messages.toggleSide, onClick: () => runtimeRef.current?.toggleSide(), children: "\u21C4" }) }),
|
|
9001
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-structures", role: "group", "aria-label": messages.structures, children: [
|
|
8345
9002
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
8346
9003
|
"div",
|
|
8347
9004
|
{
|
|
@@ -8358,15 +9015,15 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8358
9015
|
{
|
|
8359
9016
|
className: "icon-btn delimiter-command-btn",
|
|
8360
9017
|
type: "button",
|
|
8361
|
-
title:
|
|
8362
|
-
"aria-label":
|
|
9018
|
+
title: messages.insertDelimiters,
|
|
9019
|
+
"aria-label": messages.insertDelimiters,
|
|
8363
9020
|
"aria-haspopup": "listbox",
|
|
8364
9021
|
"aria-expanded": delimiterMenuOpen,
|
|
8365
9022
|
onClick: () => setDelimiterMenuOpen((open) => !open),
|
|
8366
9023
|
children: "()"
|
|
8367
9024
|
}
|
|
8368
9025
|
),
|
|
8369
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "delimiter-command-options", role: "listbox", "aria-label":
|
|
9026
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "delimiter-command-options", role: "listbox", "aria-label": messages.insertDelimiters, hidden: !delimiterMenuOpen, children: [
|
|
8370
9027
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8371
9028
|
"button",
|
|
8372
9029
|
{
|
|
@@ -8374,8 +9031,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8374
9031
|
"data-delim": "paren",
|
|
8375
9032
|
type: "button",
|
|
8376
9033
|
role: "option",
|
|
8377
|
-
title:
|
|
8378
|
-
"aria-label":
|
|
9034
|
+
title: messages.insertParentheses,
|
|
9035
|
+
"aria-label": messages.insertParentheses,
|
|
8379
9036
|
onMouseDown: (event) => event.preventDefault(),
|
|
8380
9037
|
onClick: () => {
|
|
8381
9038
|
runtimeRef.current?.insertDelimiterByKind("paren");
|
|
@@ -8392,8 +9049,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8392
9049
|
"data-delim": "bracket",
|
|
8393
9050
|
type: "button",
|
|
8394
9051
|
role: "option",
|
|
8395
|
-
title:
|
|
8396
|
-
"aria-label":
|
|
9052
|
+
title: messages.insertBrackets,
|
|
9053
|
+
"aria-label": messages.insertBrackets,
|
|
8397
9054
|
onMouseDown: (event) => event.preventDefault(),
|
|
8398
9055
|
onClick: () => {
|
|
8399
9056
|
runtimeRef.current?.insertDelimiterByKind("bracket");
|
|
@@ -8410,8 +9067,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8410
9067
|
"data-delim": "brace",
|
|
8411
9068
|
type: "button",
|
|
8412
9069
|
role: "option",
|
|
8413
|
-
title:
|
|
8414
|
-
"aria-label":
|
|
9070
|
+
title: messages.insertBraces,
|
|
9071
|
+
"aria-label": messages.insertBraces,
|
|
8415
9072
|
onMouseDown: (event) => event.preventDefault(),
|
|
8416
9073
|
onClick: () => {
|
|
8417
9074
|
runtimeRef.current?.insertDelimiterByKind("brace");
|
|
@@ -8425,19 +9082,19 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8425
9082
|
]
|
|
8426
9083
|
}
|
|
8427
9084
|
),
|
|
8428
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title:
|
|
9085
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { id: "insert-frac", className: "icon-btn frac-icon-btn", type: "button", title: messages.insertFraction, "aria-label": messages.insertFraction, onClick: () => {
|
|
8429
9086
|
runtimeRef.current?.insertFraction();
|
|
8430
9087
|
focusSurface();
|
|
8431
9088
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "toolbar-frac-icon", "aria-hidden": "true", children: [
|
|
8432
9089
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0623" }),
|
|
8433
9090
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0628" })
|
|
8434
9091
|
] }) }),
|
|
8435
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { id: "insert-sqrt", className: "icon-btn", type: "button", title:
|
|
9092
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { id: "insert-sqrt", className: "icon-btn", type: "button", title: messages.insertRoot, "aria-label": messages.insertRoot, onClick: () => {
|
|
8436
9093
|
runtimeRef.current?.insertSqrt();
|
|
8437
9094
|
focusSurface();
|
|
8438
9095
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "toolbar-sqrt-icon", "aria-hidden": "true", children: "\u221A" }) })
|
|
8439
9096
|
] }),
|
|
8440
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label":
|
|
9097
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "toolbar-group toolbar-environments", role: "group", "aria-label": messages.environments, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
8441
9098
|
"div",
|
|
8442
9099
|
{
|
|
8443
9100
|
className: "matrix-command-menu",
|
|
@@ -8453,8 +9110,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8453
9110
|
{
|
|
8454
9111
|
className: "icon-btn matrix-command-btn",
|
|
8455
9112
|
type: "button",
|
|
8456
|
-
title:
|
|
8457
|
-
"aria-label":
|
|
9113
|
+
title: messages.insertEnvironment,
|
|
9114
|
+
"aria-label": messages.insertEnvironment,
|
|
8458
9115
|
"aria-haspopup": "dialog",
|
|
8459
9116
|
"aria-expanded": matrixMenuOpen,
|
|
8460
9117
|
onClick: () => setMatrixMenuOpen((open) => !open),
|
|
@@ -8466,11 +9123,11 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8466
9123
|
] })
|
|
8467
9124
|
}
|
|
8468
9125
|
),
|
|
8469
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrix-command-popover", role: "dialog", "aria-label":
|
|
8470
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-style-options", role: "listbox", "aria-label":
|
|
8471
|
-
{ id: "matrix", label:
|
|
8472
|
-
{ id: "array", label:
|
|
8473
|
-
{ id: "aligned", label:
|
|
9126
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrix-command-popover", role: "dialog", "aria-label": messages.insertEnvironment, hidden: !matrixMenuOpen, children: [
|
|
9127
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.environmentType, children: [
|
|
9128
|
+
{ id: "matrix", label: messages.matrix },
|
|
9129
|
+
{ id: "array", label: messages.array },
|
|
9130
|
+
{ id: "aligned", label: messages.aligned }
|
|
8474
9131
|
].map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8475
9132
|
"button",
|
|
8476
9133
|
{
|
|
@@ -8489,14 +9146,14 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8489
9146
|
},
|
|
8490
9147
|
option.id
|
|
8491
9148
|
)) }),
|
|
8492
|
-
envPaletteMode === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-style-options", role: "listbox", "aria-label":
|
|
9149
|
+
envPaletteMode === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-style-options", role: "listbox", "aria-label": messages.matrixType, children: MATRIX_STYLES.map((style) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8493
9150
|
"button",
|
|
8494
9151
|
{
|
|
8495
9152
|
type: "button",
|
|
8496
9153
|
role: "option",
|
|
8497
9154
|
"aria-selected": matrixStyle === style.id,
|
|
8498
9155
|
className: "matrix-style-option",
|
|
8499
|
-
title: style.
|
|
9156
|
+
title: matrixStyleTitle(style.id, messages),
|
|
8500
9157
|
onMouseDown: (event) => event.preventDefault(),
|
|
8501
9158
|
onClick: () => {
|
|
8502
9159
|
setMatrixStyle(style.id);
|
|
@@ -8505,8 +9162,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8505
9162
|
},
|
|
8506
9163
|
style.id
|
|
8507
9164
|
)) }) : null,
|
|
8508
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-size-readout", children: matrixHover ? matrixSizeLabel(matrixHover.rows, matrixHover.columns) : matrixSizeLabel(matrixRows, matrixColumns) }),
|
|
8509
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-grid-picker", "aria-label":
|
|
9165
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-size-readout", children: matrixHover ? matrixSizeLabel(matrixHover.rows, matrixHover.columns, messages) : matrixSizeLabel(matrixRows, matrixColumns, messages) }),
|
|
9166
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "matrix-grid-picker", "aria-label": messages.chooseEnvironmentSize, children: Array.from(
|
|
8510
9167
|
{ length: 8 },
|
|
8511
9168
|
(_, rowIndex) => Array.from({ length: 8 }, (_2, columnIndex) => {
|
|
8512
9169
|
const rows = rowIndex + 1;
|
|
@@ -8518,8 +9175,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8518
9175
|
{
|
|
8519
9176
|
type: "button",
|
|
8520
9177
|
className: rows <= activeRows && columns <= activeColumns ? "matrix-grid-cell active" : "matrix-grid-cell",
|
|
8521
|
-
title: matrixSizeLabel(rows, columns),
|
|
8522
|
-
"aria-label": matrixSizeLabel(rows, columns),
|
|
9178
|
+
title: matrixSizeLabel(rows, columns, messages),
|
|
9179
|
+
"aria-label": matrixSizeLabel(rows, columns, messages),
|
|
8523
9180
|
onMouseEnter: () => setMatrixHover({ rows, columns }),
|
|
8524
9181
|
onMouseDown: (event) => event.preventDefault(),
|
|
8525
9182
|
onClick: () => {
|
|
@@ -8537,7 +9194,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8537
9194
|
) }),
|
|
8538
9195
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrix-custom-size", children: [
|
|
8539
9196
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
|
|
8540
|
-
|
|
9197
|
+
messages.row,
|
|
8541
9198
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8542
9199
|
"input",
|
|
8543
9200
|
{
|
|
@@ -8550,7 +9207,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8550
9207
|
)
|
|
8551
9208
|
] }),
|
|
8552
9209
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
|
|
8553
|
-
|
|
9210
|
+
messages.column,
|
|
8554
9211
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8555
9212
|
"input",
|
|
8556
9213
|
{
|
|
@@ -8576,15 +9233,15 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8576
9233
|
setMatrixHover(null);
|
|
8577
9234
|
focusSurface();
|
|
8578
9235
|
},
|
|
8579
|
-
children:
|
|
9236
|
+
children: messages.insert
|
|
8580
9237
|
}
|
|
8581
9238
|
)
|
|
8582
9239
|
] }),
|
|
8583
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrix-edit-actions", "aria-label":
|
|
8584
|
-
envPaletteMode === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", title:
|
|
9240
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "matrix-edit-actions", "aria-label": messages.editSelectedEnvironment, children: [
|
|
9241
|
+
envPaletteMode === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", title: messages.applySelectedMatrixStyle, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.setMatrixEnvStyle(matrixStyle), children: messages.applyStyle }) : null,
|
|
8585
9242
|
envPaletteMode === "array" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
8586
9243
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
|
|
8587
|
-
|
|
9244
|
+
messages.column,
|
|
8588
9245
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8589
9246
|
"input",
|
|
8590
9247
|
{
|
|
@@ -8600,24 +9257,36 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8600
9257
|
"button",
|
|
8601
9258
|
{
|
|
8602
9259
|
type: "button",
|
|
8603
|
-
title: alignment.title,
|
|
9260
|
+
title: alignmentCopy(alignment.id, messages).title,
|
|
8604
9261
|
onMouseDown: (event) => event.preventDefault(),
|
|
8605
9262
|
onClick: () => runtimeRef.current?.setArrayColumnAlignment(arrayAlignmentColumn - 1, alignment.id),
|
|
8606
|
-
children: alignment.label
|
|
9263
|
+
children: alignmentCopy(alignment.id, messages).label
|
|
8607
9264
|
},
|
|
8608
9265
|
alignment.id
|
|
8609
9266
|
))
|
|
8610
9267
|
] }) : null,
|
|
8611
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
9268
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", title: messages.addRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixRow(), children: [
|
|
9269
|
+
"+",
|
|
9270
|
+
messages.row
|
|
9271
|
+
] }),
|
|
9272
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", title: messages.removeRow, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixRow(), children: [
|
|
9273
|
+
"-",
|
|
9274
|
+
messages.row
|
|
9275
|
+
] }),
|
|
9276
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", title: messages.addColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.addMatrixColumn(), children: [
|
|
9277
|
+
"+",
|
|
9278
|
+
messages.column
|
|
9279
|
+
] }),
|
|
9280
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("button", { type: "button", title: messages.removeColumn, onMouseDown: (event) => event.preventDefault(), onClick: () => runtimeRef.current?.removeMatrixColumn(), children: [
|
|
9281
|
+
"-",
|
|
9282
|
+
messages.column
|
|
9283
|
+
] })
|
|
8615
9284
|
] })
|
|
8616
9285
|
] })
|
|
8617
9286
|
]
|
|
8618
9287
|
}
|
|
8619
9288
|
) }),
|
|
8620
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label":
|
|
9289
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.spaces, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
8621
9290
|
"div",
|
|
8622
9291
|
{
|
|
8623
9292
|
className: `spacing-command-menu spacing-command-menu--${activeEditorSide}`,
|
|
@@ -8633,8 +9302,8 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8633
9302
|
{
|
|
8634
9303
|
className: "icon-btn spacing-command-btn",
|
|
8635
9304
|
type: "button",
|
|
8636
|
-
title:
|
|
8637
|
-
"aria-label":
|
|
9305
|
+
title: messages.insertSpace,
|
|
9306
|
+
"aria-label": messages.insertSpace,
|
|
8638
9307
|
"aria-haspopup": "listbox",
|
|
8639
9308
|
"aria-expanded": spacingMenuOpen,
|
|
8640
9309
|
onClick: () => setSpacingMenuOpen((open) => !open),
|
|
@@ -8644,13 +9313,13 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8644
9313
|
] })
|
|
8645
9314
|
}
|
|
8646
9315
|
),
|
|
8647
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "spacing-command-options", role: "listbox", "aria-label":
|
|
9316
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "spacing-command-options", role: "listbox", "aria-label": messages.insertSpace, hidden: !spacingMenuOpen, children: SPACING_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
8648
9317
|
"button",
|
|
8649
9318
|
{
|
|
8650
9319
|
type: "button",
|
|
8651
9320
|
role: "option",
|
|
8652
9321
|
className: `spacing-command-option spacing-command-option--${command.spacing.direction}`,
|
|
8653
|
-
title: command
|
|
9322
|
+
title: atomicCommandTitle(command, uiLocale),
|
|
8654
9323
|
onMouseDown: (event) => event.preventDefault(),
|
|
8655
9324
|
onClick: () => {
|
|
8656
9325
|
runtimeRef.current?.insertAtomicCommand(command.id);
|
|
@@ -8663,7 +9332,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8663
9332
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "spacing-command-glyph__bar" }),
|
|
8664
9333
|
command.spacing.direction === "positive" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "spacing-command-glyph__arrow", children: spacingArrow(command, activeEditorSide) }) : null
|
|
8665
9334
|
] }),
|
|
8666
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "spacing-command-option__name", children: command
|
|
9335
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "spacing-command-option__name", children: atomicCommandTitle(command, uiLocale) })
|
|
8667
9336
|
]
|
|
8668
9337
|
},
|
|
8669
9338
|
command.id
|
|
@@ -8671,7 +9340,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8671
9340
|
]
|
|
8672
9341
|
}
|
|
8673
9342
|
) }),
|
|
8674
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label":
|
|
9343
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-functions", role: "group", "aria-label": messages.functions, children: [
|
|
8675
9344
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
8676
9345
|
"div",
|
|
8677
9346
|
{
|
|
@@ -8688,22 +9357,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8688
9357
|
{
|
|
8689
9358
|
className: "icon-btn function-command-btn",
|
|
8690
9359
|
type: "button",
|
|
8691
|
-
title:
|
|
8692
|
-
"aria-label":
|
|
9360
|
+
title: messages.insertFunction,
|
|
9361
|
+
"aria-label": messages.insertFunction,
|
|
8693
9362
|
"aria-haspopup": "listbox",
|
|
8694
9363
|
"aria-expanded": functionMenuOpen,
|
|
8695
9364
|
onClick: () => setFunctionMenuOpen((open) => !open),
|
|
8696
9365
|
children: FUNCTION_COMMANDS[0]?.arabicLabel ?? "\u062F"
|
|
8697
9366
|
}
|
|
8698
9367
|
),
|
|
8699
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label":
|
|
9368
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertFunction, hidden: !functionMenuOpen, children: FUNCTION_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8700
9369
|
"button",
|
|
8701
9370
|
{
|
|
8702
9371
|
className: "function-command-option",
|
|
8703
9372
|
type: "button",
|
|
8704
9373
|
role: "option",
|
|
8705
|
-
title: command
|
|
8706
|
-
"aria-label": command
|
|
9374
|
+
title: atomicCommandTitle(command, uiLocale),
|
|
9375
|
+
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
8707
9376
|
onMouseDown: (event) => event.preventDefault(),
|
|
8708
9377
|
onClick: () => {
|
|
8709
9378
|
runtimeRef.current?.insertAtomicCommand(command.id);
|
|
@@ -8733,22 +9402,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8733
9402
|
{
|
|
8734
9403
|
className: "icon-btn function-command-btn",
|
|
8735
9404
|
type: "button",
|
|
8736
|
-
title:
|
|
8737
|
-
"aria-label":
|
|
9405
|
+
title: messages.insertLimitsSeries,
|
|
9406
|
+
"aria-label": messages.insertLimitsSeries,
|
|
8738
9407
|
"aria-haspopup": "listbox",
|
|
8739
9408
|
"aria-expanded": limitsSeriesMenuOpen,
|
|
8740
9409
|
onClick: () => setLimitsSeriesMenuOpen((open) => !open),
|
|
8741
9410
|
children: LIMITS_SERIES_COMMANDS[0]?.arabicLabel ?? "\u062D\u062F"
|
|
8742
9411
|
}
|
|
8743
9412
|
),
|
|
8744
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label":
|
|
9413
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertLimitsSeries, hidden: !limitsSeriesMenuOpen, children: LIMITS_SERIES_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8745
9414
|
"button",
|
|
8746
9415
|
{
|
|
8747
9416
|
className: "function-command-option",
|
|
8748
9417
|
type: "button",
|
|
8749
9418
|
role: "option",
|
|
8750
|
-
title: command
|
|
8751
|
-
"aria-label": command
|
|
9419
|
+
title: atomicCommandTitle(command, uiLocale),
|
|
9420
|
+
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
8752
9421
|
onMouseDown: (event) => event.preventDefault(),
|
|
8753
9422
|
onClick: () => {
|
|
8754
9423
|
runtimeRef.current?.insertAtomicCommand(command.id);
|
|
@@ -8778,22 +9447,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8778
9447
|
{
|
|
8779
9448
|
className: "icon-btn function-command-btn",
|
|
8780
9449
|
type: "button",
|
|
8781
|
-
title:
|
|
8782
|
-
"aria-label":
|
|
9450
|
+
title: messages.insertAdditionalFunctions,
|
|
9451
|
+
"aria-label": messages.insertAdditionalFunctions,
|
|
8783
9452
|
"aria-haspopup": "listbox",
|
|
8784
9453
|
"aria-expanded": function2MenuOpen,
|
|
8785
9454
|
onClick: () => setFunction2MenuOpen((open) => !open),
|
|
8786
9455
|
children: FUNCTION2_COMMANDS[0]?.arabicLabel ?? "\u062F"
|
|
8787
9456
|
}
|
|
8788
9457
|
),
|
|
8789
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label":
|
|
9458
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertAdditionalFunctions, hidden: !function2MenuOpen, children: FUNCTION2_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8790
9459
|
"button",
|
|
8791
9460
|
{
|
|
8792
9461
|
className: "function-command-option",
|
|
8793
9462
|
type: "button",
|
|
8794
9463
|
role: "option",
|
|
8795
|
-
title: command
|
|
8796
|
-
"aria-label": command
|
|
9464
|
+
title: atomicCommandTitle(command, uiLocale),
|
|
9465
|
+
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
8797
9466
|
onMouseDown: (event) => event.preventDefault(),
|
|
8798
9467
|
onClick: () => {
|
|
8799
9468
|
runtimeRef.current?.insertAtomicCommand(command.id);
|
|
@@ -8823,22 +9492,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8823
9492
|
{
|
|
8824
9493
|
className: "icon-btn function-command-btn",
|
|
8825
9494
|
type: "button",
|
|
8826
|
-
title:
|
|
8827
|
-
"aria-label":
|
|
9495
|
+
title: messages.insertNumberSets,
|
|
9496
|
+
"aria-label": messages.insertNumberSets,
|
|
8828
9497
|
"aria-haspopup": "listbox",
|
|
8829
9498
|
"aria-expanded": groupMenuOpen,
|
|
8830
9499
|
onClick: () => setGroupMenuOpen((open) => !open),
|
|
8831
9500
|
children: GROUP_COMMANDS[0]?.arabicLabel ?? "\u0645"
|
|
8832
9501
|
}
|
|
8833
9502
|
),
|
|
8834
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label":
|
|
9503
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options", role: "listbox", "aria-label": messages.insertNumberSets, hidden: !groupMenuOpen, children: GROUP_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8835
9504
|
"button",
|
|
8836
9505
|
{
|
|
8837
9506
|
className: "function-command-option",
|
|
8838
9507
|
type: "button",
|
|
8839
9508
|
role: "option",
|
|
8840
|
-
title: command
|
|
8841
|
-
"aria-label": command
|
|
9509
|
+
title: atomicCommandTitle(command, uiLocale),
|
|
9510
|
+
"aria-label": atomicCommandTitle(command, uiLocale),
|
|
8842
9511
|
onMouseDown: (event) => event.preventDefault(),
|
|
8843
9512
|
onClick: () => {
|
|
8844
9513
|
runtimeRef.current?.insertAtomicCommand(command.id);
|
|
@@ -8853,7 +9522,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8853
9522
|
}
|
|
8854
9523
|
)
|
|
8855
9524
|
] }),
|
|
8856
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label":
|
|
9525
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-operators", role: "group", "aria-label": messages.operations, children: [
|
|
8857
9526
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
8858
9527
|
"div",
|
|
8859
9528
|
{
|
|
@@ -8870,22 +9539,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8870
9539
|
{
|
|
8871
9540
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
8872
9541
|
type: "button",
|
|
8873
|
-
title:
|
|
8874
|
-
"aria-label":
|
|
9542
|
+
title: messages.insertOperation,
|
|
9543
|
+
"aria-label": messages.insertOperation,
|
|
8875
9544
|
"aria-haspopup": "listbox",
|
|
8876
9545
|
"aria-expanded": operatorMenuOpen,
|
|
8877
9546
|
onClick: () => setOperatorMenuOpen((open) => !open),
|
|
8878
9547
|
children: renderOperatorMenuButtonLabel(OPERATOR_COMMANDS[0], "\u2217")
|
|
8879
9548
|
}
|
|
8880
9549
|
),
|
|
8881
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label":
|
|
9550
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertOperation, hidden: !operatorMenuOpen, children: OPERATOR_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8882
9551
|
"button",
|
|
8883
9552
|
{
|
|
8884
9553
|
className: "function-command-option operator-command-option",
|
|
8885
9554
|
type: "button",
|
|
8886
9555
|
role: "option",
|
|
8887
|
-
title: command
|
|
8888
|
-
"aria-label": command
|
|
9556
|
+
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9557
|
+
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
8889
9558
|
onMouseDown: (event) => event.preventDefault(),
|
|
8890
9559
|
onClick: () => {
|
|
8891
9560
|
runtimeRef.current?.insertAtomicOperatorCommand(command.id);
|
|
@@ -8915,22 +9584,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8915
9584
|
{
|
|
8916
9585
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
8917
9586
|
type: "button",
|
|
8918
|
-
title:
|
|
8919
|
-
"aria-label":
|
|
9587
|
+
title: messages.insertRelationsSets,
|
|
9588
|
+
"aria-label": messages.insertRelationsSets,
|
|
8920
9589
|
"aria-haspopup": "listbox",
|
|
8921
9590
|
"aria-expanded": operator2MenuOpen,
|
|
8922
9591
|
onClick: () => setOperator2MenuOpen((open) => !open),
|
|
8923
9592
|
children: "\u2229"
|
|
8924
9593
|
}
|
|
8925
9594
|
),
|
|
8926
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label":
|
|
9595
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertRelationsSets, hidden: !operator2MenuOpen, children: OPERATOR2_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8927
9596
|
"button",
|
|
8928
9597
|
{
|
|
8929
9598
|
className: "function-command-option operator-command-option",
|
|
8930
9599
|
type: "button",
|
|
8931
9600
|
role: "option",
|
|
8932
|
-
title: command
|
|
8933
|
-
"aria-label": command
|
|
9601
|
+
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9602
|
+
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
8934
9603
|
onMouseDown: (event) => event.preventDefault(),
|
|
8935
9604
|
onClick: () => {
|
|
8936
9605
|
runtimeRef.current?.insertAtomicOperatorCommand(command.id);
|
|
@@ -8960,22 +9629,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
8960
9629
|
{
|
|
8961
9630
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
8962
9631
|
type: "button",
|
|
8963
|
-
title:
|
|
8964
|
-
"aria-label":
|
|
9632
|
+
title: messages.insertArrows,
|
|
9633
|
+
"aria-label": messages.insertArrows,
|
|
8965
9634
|
"aria-haspopup": "listbox",
|
|
8966
9635
|
"aria-expanded": operator3MenuOpen,
|
|
8967
9636
|
onClick: () => setOperator3MenuOpen((open) => !open),
|
|
8968
9637
|
children: renderOperatorMenuButtonLabel(OPERATOR3_COMMANDS[0], "\u21D2")
|
|
8969
9638
|
}
|
|
8970
9639
|
),
|
|
8971
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label":
|
|
9640
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertArrows, hidden: !operator3MenuOpen, children: OPERATOR3_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
8972
9641
|
"button",
|
|
8973
9642
|
{
|
|
8974
9643
|
className: "function-command-option operator-command-option",
|
|
8975
9644
|
type: "button",
|
|
8976
9645
|
role: "option",
|
|
8977
|
-
title: command
|
|
8978
|
-
"aria-label": command
|
|
9646
|
+
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9647
|
+
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
8979
9648
|
onMouseDown: (event) => event.preventDefault(),
|
|
8980
9649
|
onClick: () => {
|
|
8981
9650
|
runtimeRef.current?.insertAtomicOperatorCommand(command.id);
|
|
@@ -9005,22 +9674,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9005
9674
|
{
|
|
9006
9675
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
9007
9676
|
type: "button",
|
|
9008
|
-
title:
|
|
9009
|
-
"aria-label":
|
|
9677
|
+
title: messages.insertDots,
|
|
9678
|
+
"aria-label": messages.insertDots,
|
|
9010
9679
|
"aria-haspopup": "listbox",
|
|
9011
9680
|
"aria-expanded": dotMenuOpen,
|
|
9012
9681
|
onClick: () => setDotMenuOpen((open) => !open),
|
|
9013
9682
|
children: renderOperatorMenuButtonLabel(DOT_COMMANDS[0], "\u2026")
|
|
9014
9683
|
}
|
|
9015
9684
|
),
|
|
9016
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label":
|
|
9685
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertDots, hidden: !dotMenuOpen, children: DOT_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
9017
9686
|
"button",
|
|
9018
9687
|
{
|
|
9019
9688
|
className: "function-command-option operator-command-option",
|
|
9020
9689
|
type: "button",
|
|
9021
9690
|
role: "option",
|
|
9022
|
-
title: command
|
|
9023
|
-
"aria-label": command
|
|
9691
|
+
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9692
|
+
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
9024
9693
|
onMouseDown: (event) => event.preventDefault(),
|
|
9025
9694
|
onClick: () => {
|
|
9026
9695
|
runtimeRef.current?.insertAtomicOperatorCommand(command.id);
|
|
@@ -9050,22 +9719,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9050
9719
|
{
|
|
9051
9720
|
className: "icon-btn function-command-btn operator-command-btn",
|
|
9052
9721
|
type: "button",
|
|
9053
|
-
title:
|
|
9054
|
-
"aria-label":
|
|
9722
|
+
title: messages.insertIntegrals,
|
|
9723
|
+
"aria-label": messages.insertIntegrals,
|
|
9055
9724
|
"aria-haspopup": "listbox",
|
|
9056
9725
|
"aria-expanded": integralMenuOpen,
|
|
9057
9726
|
onClick: () => setIntegralMenuOpen((open) => !open),
|
|
9058
9727
|
children: renderOperatorMenuButtonLabel(INTEGRAL_COMMANDS[0], "\u222B")
|
|
9059
9728
|
}
|
|
9060
9729
|
),
|
|
9061
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label":
|
|
9730
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "function-command-options operator-command-options", role: "listbox", "aria-label": messages.insertIntegrals, hidden: !integralMenuOpen, children: INTEGRAL_COMMANDS.map((command) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
9062
9731
|
"button",
|
|
9063
9732
|
{
|
|
9064
9733
|
className: "function-command-option operator-command-option",
|
|
9065
9734
|
type: "button",
|
|
9066
9735
|
role: "option",
|
|
9067
|
-
title: command
|
|
9068
|
-
"aria-label": command
|
|
9736
|
+
title: atomicOperatorCommandTitle(command, uiLocale),
|
|
9737
|
+
"aria-label": atomicOperatorCommandTitle(command, uiLocale),
|
|
9069
9738
|
onMouseDown: (event) => event.preventDefault(),
|
|
9070
9739
|
onClick: () => {
|
|
9071
9740
|
runtimeRef.current?.insertAtomicOperatorCommand(command.id);
|
|
@@ -9080,27 +9749,27 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9080
9749
|
}
|
|
9081
9750
|
)
|
|
9082
9751
|
] }),
|
|
9083
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label":
|
|
9084
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn script-icon-btn", type: "button", title:
|
|
9752
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-scripts", role: "group", "aria-label": messages.scripts, children: [
|
|
9753
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSuperscript, "aria-label": messages.addSuperscript, onClick: () => runtimeRef.current?.addSup(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "toolbar-script-icon toolbar-script-icon--sup", "aria-hidden": "true", children: [
|
|
9085
9754
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0646" }),
|
|
9086
9755
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0633" })
|
|
9087
9756
|
] }) }),
|
|
9088
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn script-icon-btn", type: "button", title:
|
|
9757
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn script-icon-btn", type: "button", title: messages.addSubscript, "aria-label": messages.addSubscript, onClick: () => runtimeRef.current?.addSub(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "toolbar-script-icon toolbar-script-icon--sub", "aria-hidden": "true", children: [
|
|
9089
9758
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0646" }),
|
|
9090
9759
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0633" })
|
|
9091
9760
|
] }) }),
|
|
9092
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title:
|
|
9761
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sup", "aria-hidden": "true", children: [
|
|
9093
9762
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0646" }),
|
|
9094
9763
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\xD7" })
|
|
9095
9764
|
] }) }),
|
|
9096
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn script-icon-btn remove-script-btn", type: "button", title:
|
|
9765
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "toolbar-remove-script-icon toolbar-remove-script-icon--sub", "aria-hidden": "true", children: [
|
|
9097
9766
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u0646" }),
|
|
9098
9767
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\xD7" })
|
|
9099
9768
|
] }) })
|
|
9100
9769
|
] }),
|
|
9101
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label":
|
|
9102
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn delete-node-btn", type: "button", title:
|
|
9103
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { ref: splitTypingBtnRef, id: "toggle-split-leaf-typing", className: "icon-btn ligature-btn", type: "button", title:
|
|
9770
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "toolbar-group toolbar-settings", role: "group", "aria-label": messages.inputStyles, children: [
|
|
9771
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { className: "icon-btn delete-node-btn", type: "button", title: messages.deleteSelectedStructure, "aria-label": messages.deleteSelectedStructure, onClick: () => runtimeRef.current?.deleteStructure(), children: "\xD7" }),
|
|
9772
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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" }),
|
|
9104
9773
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
9105
9774
|
"div",
|
|
9106
9775
|
{
|
|
@@ -9119,22 +9788,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9119
9788
|
id: "select-character-font",
|
|
9120
9789
|
className: `icon-btn font-mode-btn font-mode-btn--${selectedCharacterFont}`,
|
|
9121
9790
|
type: "button",
|
|
9122
|
-
title:
|
|
9123
|
-
"aria-label":
|
|
9791
|
+
title: characterFontTitle(selectedCharacterFont, messages),
|
|
9792
|
+
"aria-label": messages.chooseWritingFont,
|
|
9124
9793
|
"aria-haspopup": "listbox",
|
|
9125
9794
|
"aria-expanded": characterFontMenuOpen,
|
|
9126
9795
|
onClick: () => setCharacterFontMenuOpen((open) => !open),
|
|
9127
9796
|
children: characterFontOption(selectedCharacterFont).label
|
|
9128
9797
|
}
|
|
9129
9798
|
),
|
|
9130
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "character-font-options", role: "listbox", "aria-label":
|
|
9799
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "character-font-options", role: "listbox", "aria-label": messages.chooseWritingFont, hidden: !characterFontMenuOpen, children: CHARACTER_FONT_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
9131
9800
|
"button",
|
|
9132
9801
|
{
|
|
9133
9802
|
type: "button",
|
|
9134
9803
|
role: "option",
|
|
9135
9804
|
"aria-selected": selectedCharacterFont === option.id,
|
|
9136
9805
|
className: `character-font-option character-font-option--${option.id}`,
|
|
9137
|
-
title: option.
|
|
9806
|
+
title: characterFontTitle(option.id, messages),
|
|
9138
9807
|
onMouseDown: (event) => event.preventDefault(),
|
|
9139
9808
|
onClick: () => {
|
|
9140
9809
|
runtimeRef.current?.setCurrentCharacterFont(option.id);
|
|
@@ -9167,22 +9836,22 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9167
9836
|
id: "select-digit-form",
|
|
9168
9837
|
className: "icon-btn digit-form-btn",
|
|
9169
9838
|
type: "button",
|
|
9170
|
-
title:
|
|
9171
|
-
"aria-label":
|
|
9839
|
+
title: messages.chooseDigitForm,
|
|
9840
|
+
"aria-label": messages.chooseDigitForm,
|
|
9172
9841
|
"aria-haspopup": "listbox",
|
|
9173
9842
|
"aria-expanded": digitMenuOpen,
|
|
9174
9843
|
onClick: () => setDigitMenuOpen((open) => !open),
|
|
9175
9844
|
children: digitFormLabel(selectedDigitForm2)
|
|
9176
9845
|
}
|
|
9177
9846
|
),
|
|
9178
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "digit-form-options", role: "listbox", "aria-label":
|
|
9847
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "digit-form-options", role: "listbox", "aria-label": messages.chooseDigitForm, hidden: !digitMenuOpen, children: DIGIT_FORM_OPTIONS.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
9179
9848
|
"button",
|
|
9180
9849
|
{
|
|
9181
9850
|
type: "button",
|
|
9182
9851
|
role: "option",
|
|
9183
9852
|
"aria-selected": selectedDigitForm2 === option.id,
|
|
9184
9853
|
className: "digit-form-option",
|
|
9185
|
-
title: option.
|
|
9854
|
+
title: digitFormTitle(option.id, messages),
|
|
9186
9855
|
onMouseDown: (event) => event.preventDefault(),
|
|
9187
9856
|
onClick: () => {
|
|
9188
9857
|
runtimeRef.current?.setCurrentDigitForm(option.id);
|
|
@@ -9206,15 +9875,15 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9206
9875
|
id: "butex-editor-surface",
|
|
9207
9876
|
className: "surface surface--arabic",
|
|
9208
9877
|
tabIndex: 0,
|
|
9209
|
-
"aria-label":
|
|
9878
|
+
"aria-label": messages.equationEditor
|
|
9210
9879
|
}
|
|
9211
9880
|
),
|
|
9212
9881
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: renderErrorRef, className: "error", hidden: true })
|
|
9213
9882
|
] }),
|
|
9214
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: "panel panel-preview", "aria-label":
|
|
9883
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("section", { className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: mathOutputRef, className: "preview-box" }) }),
|
|
9215
9884
|
debug ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "panel", children: [
|
|
9216
9885
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "dev-strip", children: [
|
|
9217
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "dev-badge", children:
|
|
9886
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "dev-badge", children: messages.development }),
|
|
9218
9887
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: latexLinesRef, className: "ascii" }),
|
|
9219
9888
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: passivePreviewRef, className: "passive-preview-text" })
|
|
9220
9889
|
] }),
|
|
@@ -9237,7 +9906,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9237
9906
|
return next;
|
|
9238
9907
|
});
|
|
9239
9908
|
},
|
|
9240
|
-
children: debugBodyHidden ?
|
|
9909
|
+
children: debugBodyHidden ? messages.showDebugLog : messages.hideDebugLog
|
|
9241
9910
|
}
|
|
9242
9911
|
),
|
|
9243
9912
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -9251,7 +9920,7 @@ ${arabic || "\u0641\u0627\u0631\u063A"}`;
|
|
|
9251
9920
|
} catch {
|
|
9252
9921
|
}
|
|
9253
9922
|
},
|
|
9254
|
-
children:
|
|
9923
|
+
children: messages.copyDebugLog
|
|
9255
9924
|
}
|
|
9256
9925
|
)
|
|
9257
9926
|
] }),
|
|
@@ -9272,11 +9941,14 @@ function EquationDrawer({
|
|
|
9272
9941
|
reason,
|
|
9273
9942
|
mathMode,
|
|
9274
9943
|
canDelete = false,
|
|
9944
|
+
equationSide = "arabic",
|
|
9945
|
+
uiLocale = "ar",
|
|
9275
9946
|
onMathModeChange,
|
|
9276
9947
|
onClose,
|
|
9277
9948
|
onSave,
|
|
9278
9949
|
onDelete
|
|
9279
9950
|
}) {
|
|
9951
|
+
const messages = document2Messages(uiLocale);
|
|
9280
9952
|
const latestSession = (0, import_react5.useRef)(session);
|
|
9281
9953
|
(0, import_react5.useEffect)(() => {
|
|
9282
9954
|
const onKeyDown = (event) => {
|
|
@@ -9293,7 +9965,7 @@ function EquationDrawer({
|
|
|
9293
9965
|
{
|
|
9294
9966
|
type: "button",
|
|
9295
9967
|
className: "butex-document2-widget__equation-modal-backdrop",
|
|
9296
|
-
"aria-label":
|
|
9968
|
+
"aria-label": messages.closeEquationDialog,
|
|
9297
9969
|
onClick: onClose
|
|
9298
9970
|
}
|
|
9299
9971
|
),
|
|
@@ -9304,30 +9976,39 @@ function EquationDrawer({
|
|
|
9304
9976
|
role: "dialog",
|
|
9305
9977
|
"aria-modal": "true",
|
|
9306
9978
|
"aria-labelledby": "butex-document2-equation-modal-title",
|
|
9307
|
-
dir:
|
|
9979
|
+
dir: uiLocaleDirection(uiLocale),
|
|
9980
|
+
lang: uiLocale,
|
|
9308
9981
|
children: [
|
|
9309
9982
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "butex-document2-widget__row", children: [
|
|
9310
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: "butex-document2-equation-modal-title", children:
|
|
9311
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick: onClose, children:
|
|
9983
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: "butex-document2-equation-modal-title", children: messages.equationEditorTitle }),
|
|
9984
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick: onClose, children: messages.close })
|
|
9312
9985
|
] }),
|
|
9313
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "butex-document2-widget__row", role: "group", "aria-label":
|
|
9314
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.
|
|
9315
|
-
|
|
9986
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "butex-document2-widget__row", role: "group", "aria-label": messages.equationType, children: [
|
|
9987
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", "aria-pressed": mathMode === "inline", onClick: () => onMathModeChange("inline"), children: [
|
|
9988
|
+
messages.inline,
|
|
9989
|
+
" ($)"
|
|
9990
|
+
] }),
|
|
9991
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", "aria-pressed": mathMode === "display", onClick: () => onMathModeChange("display"), children: [
|
|
9992
|
+
messages.displayed,
|
|
9993
|
+
" (\\\\[)"
|
|
9994
|
+
] })
|
|
9316
9995
|
] }),
|
|
9317
|
-
reason ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "butex-document2-widget__error", children: reason }) : null,
|
|
9996
|
+
reason ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "butex-document2-widget__error", children: uiLocale === "en" ? messages.equationUnavailable : reason }) : null,
|
|
9318
9997
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
9319
9998
|
ButexEditor,
|
|
9320
9999
|
{
|
|
9321
10000
|
debug: false,
|
|
10001
|
+
defaultSide: equationSide,
|
|
10002
|
+
uiLocale,
|
|
9322
10003
|
initialSession: session,
|
|
9323
10004
|
onSessionChange: (nextSession) => {
|
|
9324
|
-
latestSession.current =
|
|
10005
|
+
latestSession.current = nextSession;
|
|
9325
10006
|
}
|
|
9326
10007
|
}
|
|
9327
10008
|
),
|
|
9328
10009
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "butex-document2-widget__row", children: [
|
|
9329
|
-
canDelete && onDelete ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: onDelete, children:
|
|
9330
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick: () => onSave({ ...latestSession.current, activeSide:
|
|
10010
|
+
canDelete && onDelete ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "butex-document2-widget__button--danger", onClick: onDelete, children: messages.deleteEquation }) : null,
|
|
10011
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", onClick: () => onSave({ ...latestSession.current, activeSide: equationSide }), children: messages.saveEquation })
|
|
9331
10012
|
] })
|
|
9332
10013
|
]
|
|
9333
10014
|
}
|
|
@@ -9753,6 +10434,12 @@ var DOCUMENT2_WIDGET_CSS = `
|
|
|
9753
10434
|
margin-block-start: 6px;
|
|
9754
10435
|
}
|
|
9755
10436
|
|
|
10437
|
+
.butex-document2-widget__list-item-content {
|
|
10438
|
+
display: grid;
|
|
10439
|
+
gap: 8px;
|
|
10440
|
+
min-width: 0;
|
|
10441
|
+
}
|
|
10442
|
+
|
|
9756
10443
|
.butex-document2-widget__list-footer {
|
|
9757
10444
|
border-block-start: 1px dashed color-mix(in srgb, var(--butex-document2-border) 85%, transparent);
|
|
9758
10445
|
margin-block-start: 10px;
|
|
@@ -9911,6 +10598,7 @@ var DOCUMENT2_WIDGET_CSS = `
|
|
|
9911
10598
|
overflow-wrap: break-word;
|
|
9912
10599
|
overflow-y: hidden;
|
|
9913
10600
|
resize: none;
|
|
10601
|
+
text-align: start;
|
|
9914
10602
|
white-space: pre-wrap;
|
|
9915
10603
|
width: auto;
|
|
9916
10604
|
word-break: break-word;
|
|
@@ -9966,13 +10654,13 @@ var DOCUMENT2_WIDGET_CSS = `
|
|
|
9966
10654
|
.butex-document2-widget__preview {
|
|
9967
10655
|
background: var(--butex-document2-preview-bg);
|
|
9968
10656
|
color: var(--butex-document2-preview-fg);
|
|
9969
|
-
direction: rtl;
|
|
9970
10657
|
font-family: var(--butex-document2-preview-font);
|
|
9971
10658
|
font-size: 1.08rem;
|
|
9972
10659
|
line-height: 1.9;
|
|
9973
10660
|
max-width: 100%;
|
|
9974
10661
|
min-width: 0;
|
|
9975
10662
|
overflow-wrap: break-word;
|
|
10663
|
+
text-align: start;
|
|
9976
10664
|
word-break: break-word;
|
|
9977
10665
|
}
|
|
9978
10666
|
|
|
@@ -9987,6 +10675,51 @@ var DOCUMENT2_WIDGET_CSS = `
|
|
|
9987
10675
|
word-break: break-word;
|
|
9988
10676
|
}
|
|
9989
10677
|
|
|
10678
|
+
.butex-document2-widget__preview h1 {
|
|
10679
|
+
font-size: 1.75rem;
|
|
10680
|
+
font-weight: 700;
|
|
10681
|
+
line-height: 1.35;
|
|
10682
|
+
margin: 0 0 14px;
|
|
10683
|
+
}
|
|
10684
|
+
|
|
10685
|
+
.butex-document2-widget__preview h2 {
|
|
10686
|
+
font-size: 1.4rem;
|
|
10687
|
+
font-weight: 600;
|
|
10688
|
+
line-height: 1.4;
|
|
10689
|
+
margin: 0 0 12px;
|
|
10690
|
+
}
|
|
10691
|
+
|
|
10692
|
+
.butex-document2-widget__preview h3 {
|
|
10693
|
+
font-size: 1.2rem;
|
|
10694
|
+
font-weight: 600;
|
|
10695
|
+
line-height: 1.45;
|
|
10696
|
+
margin: 0 0 10px;
|
|
10697
|
+
}
|
|
10698
|
+
|
|
10699
|
+
.butex-document2-widget__preview p {
|
|
10700
|
+
margin: 0 0 12px;
|
|
10701
|
+
}
|
|
10702
|
+
|
|
10703
|
+
.butex-document2-widget__preview ul,
|
|
10704
|
+
.butex-document2-widget__preview ol {
|
|
10705
|
+
margin: 0 0 12px;
|
|
10706
|
+
padding-inline-start: 24px;
|
|
10707
|
+
}
|
|
10708
|
+
|
|
10709
|
+
.butex-document2-widget__preview ul {
|
|
10710
|
+
list-style-type: disc;
|
|
10711
|
+
}
|
|
10712
|
+
|
|
10713
|
+
.butex-document2-widget__preview ol {
|
|
10714
|
+
list-style-type: decimal;
|
|
10715
|
+
}
|
|
10716
|
+
|
|
10717
|
+
.butex-document2-widget__preview img {
|
|
10718
|
+
display: block;
|
|
10719
|
+
height: auto;
|
|
10720
|
+
max-width: 100%;
|
|
10721
|
+
}
|
|
10722
|
+
|
|
9990
10723
|
.butex-document2-widget__preview table {
|
|
9991
10724
|
border-collapse: collapse;
|
|
9992
10725
|
border: 1px solid #000000;
|
|
@@ -10357,21 +11090,21 @@ function topLevelBlockIdForField(document2, fieldId) {
|
|
|
10357
11090
|
function topLevelBlockIdForToken(document2, tokenId) {
|
|
10358
11091
|
return document2.blocks.find((block) => blockHasToken(block, tokenId))?.id ?? null;
|
|
10359
11092
|
}
|
|
10360
|
-
function
|
|
11093
|
+
function formatDocument2Diagnostic(d, messages) {
|
|
10361
11094
|
if (d.message === "math_objects order mismatch") {
|
|
10362
|
-
return
|
|
11095
|
+
return `${messages.importOrderMismatch} ${messages.path}: ${d.path}`;
|
|
10363
11096
|
}
|
|
10364
11097
|
const countMismatch = /^math_objects count mismatch: detected (\d+), got (\d+)$/.exec(d.message);
|
|
10365
11098
|
if (countMismatch) {
|
|
10366
11099
|
const [, detected, got] = countMismatch;
|
|
10367
|
-
return
|
|
11100
|
+
return `${messages.importCountMismatch} (${detected}/${got}) ${messages.path}: ${d.path}`;
|
|
10368
11101
|
}
|
|
10369
|
-
return
|
|
11102
|
+
return `${messages.importWarning}: ${d.message} \u2014 ${messages.path}: ${d.path}`;
|
|
10370
11103
|
}
|
|
10371
11104
|
function isDocument2Node(value) {
|
|
10372
11105
|
return typeof value === "object" && value !== null && value.nodeType === "DocumentObject" && Array.isArray(value.blocks) && Array.isArray(value.diagnostics);
|
|
10373
11106
|
}
|
|
10374
|
-
function resolveInitialDocument2(initialDocument) {
|
|
11107
|
+
function resolveInitialDocument2(initialDocument, uiLocale = "ar") {
|
|
10375
11108
|
if (!initialDocument) {
|
|
10376
11109
|
return { document: createEmptyDocument2(), error: null };
|
|
10377
11110
|
}
|
|
@@ -10382,18 +11115,23 @@ function resolveInitialDocument2(initialDocument) {
|
|
|
10382
11115
|
return { document: fromDocumentJson2(initialDocument), error: null };
|
|
10383
11116
|
} catch (err) {
|
|
10384
11117
|
const detail = err instanceof Error ? err.message : String(err);
|
|
10385
|
-
return { document: createEmptyDocument2(), error:
|
|
11118
|
+
return { document: createEmptyDocument2(), error: `${document2Messages(uiLocale).loadDocumentError}: ${detail}` };
|
|
10386
11119
|
}
|
|
10387
11120
|
}
|
|
10388
11121
|
function ButexDocumentEditor2({
|
|
10389
11122
|
initialDocument,
|
|
10390
11123
|
className,
|
|
10391
11124
|
debug = false,
|
|
11125
|
+
documentDirection = "rtl",
|
|
11126
|
+
equationSide = "arabic",
|
|
11127
|
+
editableEquations = true,
|
|
11128
|
+
uiLocale = "ar",
|
|
10392
11129
|
mathOutput = "svg",
|
|
10393
11130
|
onDocumentChange,
|
|
10394
11131
|
onLatexChange
|
|
10395
11132
|
}) {
|
|
10396
|
-
const
|
|
11133
|
+
const messages = document2Messages(uiLocale);
|
|
11134
|
+
const initialState = (0, import_react6.useMemo)(() => resolveInitialDocument2(initialDocument, uiLocale), [initialDocument]);
|
|
10397
11135
|
const [documentNode, setDocumentNode] = (0, import_react6.useState)(initialState.document);
|
|
10398
11136
|
const [error, setError] = (0, import_react6.useState)(initialState.error);
|
|
10399
11137
|
const [editorOpen, setEditorOpen] = (0, import_react6.useState)(true);
|
|
@@ -10410,7 +11148,10 @@ function ButexDocumentEditor2({
|
|
|
10410
11148
|
const pendingFocusRef = (0, import_react6.useRef)(null);
|
|
10411
11149
|
documentRef.current = documentNode;
|
|
10412
11150
|
const latex = document2Latex(documentNode);
|
|
10413
|
-
const preview = (0, import_react6.useMemo)(
|
|
11151
|
+
const preview = (0, import_react6.useMemo)(
|
|
11152
|
+
() => document2Preview(documentNode, mathOutput, equationSide),
|
|
11153
|
+
[documentNode, equationSide, mathOutput]
|
|
11154
|
+
);
|
|
10414
11155
|
const debugEnabled = (0, import_react6.useMemo)(() => {
|
|
10415
11156
|
if (debug) {
|
|
10416
11157
|
return true;
|
|
@@ -10426,7 +11167,12 @@ function ButexDocumentEditor2({
|
|
|
10426
11167
|
injectBuTeXDocument2Styles();
|
|
10427
11168
|
}, []);
|
|
10428
11169
|
(0, import_react6.useEffect)(() => {
|
|
10429
|
-
|
|
11170
|
+
if (!editableEquations) {
|
|
11171
|
+
setSelectedMath(null);
|
|
11172
|
+
}
|
|
11173
|
+
}, [editableEquations]);
|
|
11174
|
+
(0, import_react6.useEffect)(() => {
|
|
11175
|
+
const next = resolveInitialDocument2(initialDocument, uiLocale);
|
|
10430
11176
|
setDocumentNode(next.document);
|
|
10431
11177
|
setError(next.error);
|
|
10432
11178
|
setSelectedMath(null);
|
|
@@ -10568,7 +11314,7 @@ function ButexDocumentEditor2({
|
|
|
10568
11314
|
openBlock(blockId);
|
|
10569
11315
|
setEditorFocus({ blockId, fieldId, textTokenId, caretOffset });
|
|
10570
11316
|
}
|
|
10571
|
-
function rememberMathFocus(blockId, fieldId
|
|
11317
|
+
function rememberMathFocus(blockId, fieldId) {
|
|
10572
11318
|
openBlock(blockId);
|
|
10573
11319
|
setEditorFocus({ blockId, fieldId, textTokenId: null, caretOffset: 0 });
|
|
10574
11320
|
}
|
|
@@ -10580,6 +11326,9 @@ function ButexDocumentEditor2({
|
|
|
10580
11326
|
textSnapshotArmedRef.current = false;
|
|
10581
11327
|
}
|
|
10582
11328
|
function openNewEquation(mode) {
|
|
11329
|
+
if (!editableEquations) {
|
|
11330
|
+
return;
|
|
11331
|
+
}
|
|
10583
11332
|
const target = resolveInsertField(documentRef.current, editorFocus);
|
|
10584
11333
|
if (target?.fieldId) {
|
|
10585
11334
|
openBlock(topLevelBlockIdForField(documentRef.current, target.fieldId));
|
|
@@ -10590,13 +11339,16 @@ function ButexDocumentEditor2({
|
|
|
10590
11339
|
textTokenId: target?.textTokenId ?? null,
|
|
10591
11340
|
insertAt: target?.caretOffset ?? 0,
|
|
10592
11341
|
mathMode: mode,
|
|
10593
|
-
session:
|
|
11342
|
+
session: createEmptyEquationSession(equationSide),
|
|
10594
11343
|
reason: null
|
|
10595
11344
|
});
|
|
10596
11345
|
}
|
|
10597
11346
|
function openMath(token) {
|
|
11347
|
+
if (!editableEquations) {
|
|
11348
|
+
return;
|
|
11349
|
+
}
|
|
10598
11350
|
openBlock(topLevelBlockIdForToken(documentRef.current, token.id));
|
|
10599
|
-
const result =
|
|
11351
|
+
const result = mathTokenToEditorSession(token.math, equationSide);
|
|
10600
11352
|
const mode = token.display ? "display" : "inline";
|
|
10601
11353
|
if (!result.editable) {
|
|
10602
11354
|
setSelectedMath({
|
|
@@ -10605,7 +11357,7 @@ function ButexDocumentEditor2({
|
|
|
10605
11357
|
insertAt: 0,
|
|
10606
11358
|
textTokenId: null,
|
|
10607
11359
|
mathMode: mode,
|
|
10608
|
-
session:
|
|
11360
|
+
session: createEmptyEquationSession(equationSide),
|
|
10609
11361
|
reason: result.reason
|
|
10610
11362
|
});
|
|
10611
11363
|
return;
|
|
@@ -10642,7 +11394,14 @@ function ButexDocumentEditor2({
|
|
|
10642
11394
|
}
|
|
10643
11395
|
const delimiters = mathDelimiters(selectedMath.mathMode);
|
|
10644
11396
|
if (selectedMath.tokenId) {
|
|
10645
|
-
const next2 = replaceMathTokenFromSession(
|
|
11397
|
+
const next2 = replaceMathTokenFromSession(
|
|
11398
|
+
documentRef.current,
|
|
11399
|
+
selectedMath.tokenId,
|
|
11400
|
+
session,
|
|
11401
|
+
delimiters.opening,
|
|
11402
|
+
delimiters.closing,
|
|
11403
|
+
equationSide
|
|
11404
|
+
);
|
|
10646
11405
|
pendingFocusRef.current = { kind: "math", tokenId: selectedMath.tokenId };
|
|
10647
11406
|
applyDocument(next2, "immediate");
|
|
10648
11407
|
setSelectedMath(null);
|
|
@@ -10667,7 +11426,16 @@ function ButexDocumentEditor2({
|
|
|
10667
11426
|
textTokenId = field.tokens.find((token) => token.kind === "text")?.id ?? null;
|
|
10668
11427
|
insertAt = 0;
|
|
10669
11428
|
}
|
|
10670
|
-
const next = insertMathTokenAtCaret(
|
|
11429
|
+
const next = insertMathTokenAtCaret(
|
|
11430
|
+
current,
|
|
11431
|
+
fieldId,
|
|
11432
|
+
textTokenId,
|
|
11433
|
+
insertAt,
|
|
11434
|
+
session,
|
|
11435
|
+
delimiters.opening,
|
|
11436
|
+
delimiters.closing,
|
|
11437
|
+
equationSide
|
|
11438
|
+
);
|
|
10671
11439
|
const trailingTextTokenId = trailingTextTokenAfterInsertedMath(current, next, fieldId, textTokenId, insertAt);
|
|
10672
11440
|
if (trailingTextTokenId) {
|
|
10673
11441
|
pendingFocusRef.current = { kind: "text", fieldId, textTokenId: trailingTextTokenId, caretOffset: 0 };
|
|
@@ -10691,110 +11459,127 @@ function ButexDocumentEditor2({
|
|
|
10691
11459
|
pendingFocusRef.current = focusAfterDeletedMath(current, next, tokenId);
|
|
10692
11460
|
applyDocument(next, "immediate");
|
|
10693
11461
|
}
|
|
10694
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
onAddSection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\section", afterBlockId()), "immediate"),
|
|
10704
|
-
onAddSubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsection", afterBlockId()), "immediate"),
|
|
10705
|
-
onAddSubsubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsubsection", afterBlockId()), "immediate"),
|
|
10706
|
-
onAddParagraph: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\paragraph", afterBlockId()), "immediate"),
|
|
10707
|
-
onAddInlineEquation: () => openNewEquation("inline"),
|
|
10708
|
-
onAddDisplayEquation: () => openNewEquation("display"),
|
|
10709
|
-
onAddTable: (rowCount, colCount) => applyDocument(addDocument2TableBlock(documentRef.current, "l".repeat(colCount), rowCount, colCount, afterBlockId()), "immediate"),
|
|
10710
|
-
onAddList: () => applyDocument(addDocument2ListBlock(documentRef.current, false, afterBlockId()), "immediate"),
|
|
10711
|
-
onAddEnumerate: () => applyDocument(addDocument2ListBlock(documentRef.current, true, afterBlockId()), "immediate"),
|
|
10712
|
-
onAddFigure: () => applyDocument(addDocument2ImageBlock(documentRef.current, "", afterBlockId()), "immediate")
|
|
10713
|
-
}
|
|
10714
|
-
),
|
|
10715
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": "\u0627\u0644\u0644\u0648\u062D\u0627\u062A", children: [
|
|
10716
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062A\u062D\u0631\u064A\u0631" : "\u062A\u062D\u0631\u064A\u0631" }),
|
|
10717
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? "\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629" : "\u0645\u0639\u0627\u064A\u0646\u0629" })
|
|
10718
|
-
] }),
|
|
10719
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": "\u0637\u064A \u0627\u0644\u0643\u062A\u0644", children: [
|
|
10720
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: collapseAllBlocks, children: "\u0637\u064A \u0627\u0644\u0643\u0644" }),
|
|
10721
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: openAllBlocks, children: "\u0641\u062A\u062D \u0627\u0644\u0643\u0644" })
|
|
10722
|
-
] })
|
|
10723
|
-
] }),
|
|
10724
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "butex-document2-widget__error", children: error }) : null,
|
|
10725
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
10726
|
-
"div",
|
|
10727
|
-
{
|
|
10728
|
-
className: `butex-document2-widget__layout butex-document2-widget__layout--editor-${editorOpen ? "open" : "closed"} butex-document2-widget__layout--preview-${previewOpen ? "open" : "closed"}`,
|
|
10729
|
-
children: [
|
|
11462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
11463
|
+
"div",
|
|
11464
|
+
{
|
|
11465
|
+
ref: widgetRef,
|
|
11466
|
+
className: ["butex-document2-widget", className].filter(Boolean).join(" "),
|
|
11467
|
+
dir: uiLocaleDirection(uiLocale),
|
|
11468
|
+
lang: uiLocale,
|
|
11469
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document2-widget__shell", children: [
|
|
11470
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document2-widget__toolbar", children: [
|
|
10730
11471
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
10731
|
-
|
|
11472
|
+
DocumentInsertToolbar,
|
|
10732
11473
|
{
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
onToggleCollapse: toggleBlockCollapse,
|
|
10750
|
-
onBlockFocus: rememberBlockFocus,
|
|
10751
|
-
onFieldFocus: rememberFieldFocus,
|
|
10752
|
-
onMathFocus: rememberMathFocus,
|
|
10753
|
-
onFieldBlur,
|
|
10754
|
-
onImageSrcChange: (blockId, value) => applyDocument(updateDocument2ImageValue(documentRef.current, blockId, value), "text"),
|
|
10755
|
-
onAddListItem: (listBlockId) => applyDocument(addDocument2ListItem(documentRef.current, listBlockId), "immediate"),
|
|
10756
|
-
onRemoveListItem: (listBlockId, itemId) => applyDocument(removeDocument2ListItem(documentRef.current, listBlockId, itemId), "immediate")
|
|
10757
|
-
},
|
|
10758
|
-
block.id
|
|
10759
|
-
)) })
|
|
11474
|
+
canUndo,
|
|
11475
|
+
canRedo,
|
|
11476
|
+
editableEquations,
|
|
11477
|
+
uiLocale,
|
|
11478
|
+
onUndo: undoDocument,
|
|
11479
|
+
onRedo: redoDocument,
|
|
11480
|
+
onAddSection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\section", afterBlockId()), "immediate"),
|
|
11481
|
+
onAddSubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsection", afterBlockId()), "immediate"),
|
|
11482
|
+
onAddSubsubsection: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\subsubsection", afterBlockId()), "immediate"),
|
|
11483
|
+
onAddParagraph: () => applyDocument(addDocument2TextBlock(documentRef.current, "\\paragraph", afterBlockId()), "immediate"),
|
|
11484
|
+
onAddInlineEquation: () => openNewEquation("inline"),
|
|
11485
|
+
onAddDisplayEquation: () => openNewEquation("display"),
|
|
11486
|
+
onAddTable: (rowCount, colCount) => applyDocument(addDocument2TableBlock(documentRef.current, "l".repeat(colCount), rowCount, colCount, afterBlockId()), "immediate"),
|
|
11487
|
+
onAddList: () => applyDocument(addDocument2ListBlock(documentRef.current, false, afterBlockId()), "immediate"),
|
|
11488
|
+
onAddEnumerate: () => applyDocument(addDocument2ListBlock(documentRef.current, true, afterBlockId()), "immediate"),
|
|
11489
|
+
onAddFigure: () => applyDocument(addDocument2ImageBlock(documentRef.current, "", afterBlockId()), "immediate")
|
|
10760
11490
|
}
|
|
10761
11491
|
),
|
|
10762
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.
|
|
10763
|
-
"
|
|
10764
|
-
{
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
11492
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.panels, children: [
|
|
11493
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-pressed": editorOpen, onClick: toggleEditorPanel, children: editorOpen ? messages.hideEditor : messages.editor }),
|
|
11494
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-pressed": previewOpen, onClick: togglePreviewPanel, children: previewOpen ? messages.hidePreview : messages.preview })
|
|
11495
|
+
] }),
|
|
11496
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document2-widget__toolbar-group", role: "group", "aria-label": messages.collapseBlocks, children: [
|
|
11497
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: collapseAllBlocks, children: messages.collapseAll }),
|
|
11498
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", onClick: openAllBlocks, children: messages.openAll })
|
|
11499
|
+
] })
|
|
11500
|
+
] }),
|
|
11501
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "butex-document2-widget__error", children: error }) : null,
|
|
11502
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
11503
|
+
"div",
|
|
11504
|
+
{
|
|
11505
|
+
className: `butex-document2-widget__layout butex-document2-widget__layout--editor-${editorOpen ? "open" : "closed"} butex-document2-widget__layout--preview-${previewOpen ? "open" : "closed"}`,
|
|
11506
|
+
children: [
|
|
11507
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
11508
|
+
"section",
|
|
11509
|
+
{
|
|
11510
|
+
className: "butex-document2-widget__panel butex-document2-widget__editor-panel",
|
|
11511
|
+
"aria-label": messages.documentEditor,
|
|
11512
|
+
"aria-hidden": !editorOpen,
|
|
11513
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "butex-document2-widget__blocks", children: documentNode.blocks.map((block, blockIndex) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
11514
|
+
BlockEditor,
|
|
11515
|
+
{
|
|
11516
|
+
block,
|
|
11517
|
+
blockIndex,
|
|
11518
|
+
blockCount: documentNode.blocks.length,
|
|
11519
|
+
documentDirection,
|
|
11520
|
+
mathOutput,
|
|
11521
|
+
equationSide,
|
|
11522
|
+
editableEquations,
|
|
11523
|
+
uiLocale,
|
|
11524
|
+
isCollapsed: collapsedBlockIds.has(block.id),
|
|
11525
|
+
onTextChange: (fieldId, tokenId, text) => applyDocument(updateTextToken(documentRef.current, fieldId, tokenId, text), "text"),
|
|
11526
|
+
onOpenMath: openMath,
|
|
11527
|
+
onDeleteMath: editableEquations ? deleteMathToken : void 0,
|
|
11528
|
+
onRemoveBlock: (blockId) => applyDocument(removeDocument2BlockById(documentRef.current, blockId), "immediate"),
|
|
11529
|
+
onMoveBlock: (blockId, direction) => applyDocument(moveDocument2BlockById(documentRef.current, blockId, direction), "immediate"),
|
|
11530
|
+
onToggleCollapse: toggleBlockCollapse,
|
|
11531
|
+
onBlockFocus: rememberBlockFocus,
|
|
11532
|
+
onFieldFocus: rememberFieldFocus,
|
|
11533
|
+
onMathFocus: rememberMathFocus,
|
|
11534
|
+
onFieldBlur,
|
|
11535
|
+
onImageSrcChange: (blockId, value) => applyDocument(updateDocument2ImageValue(documentRef.current, blockId, value), "text"),
|
|
11536
|
+
onAddListItem: (listBlockId) => applyDocument(addDocument2ListItem(documentRef.current, listBlockId), "immediate"),
|
|
11537
|
+
onRemoveListItem: (listBlockId, itemId) => applyDocument(removeDocument2ListItem(documentRef.current, listBlockId, itemId), "immediate")
|
|
11538
|
+
},
|
|
11539
|
+
block.id
|
|
11540
|
+
)) })
|
|
11541
|
+
}
|
|
11542
|
+
),
|
|
11543
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
11544
|
+
"section",
|
|
11545
|
+
{
|
|
11546
|
+
className: "butex-document2-widget__panel butex-document2-widget__preview-panel",
|
|
11547
|
+
"aria-label": messages.documentPreview,
|
|
11548
|
+
"aria-hidden": !previewOpen,
|
|
11549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DocumentPreview, { blocks: preview.blocks, output: mathOutput, documentDirection, uiLocale })
|
|
11550
|
+
}
|
|
11551
|
+
)
|
|
11552
|
+
]
|
|
11553
|
+
}
|
|
11554
|
+
),
|
|
11555
|
+
debugEnabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "butex-document2-widget__dev", children: [
|
|
11556
|
+
debugEnabled && documentNode.diagnostics.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
11557
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: messages.importWarnings }),
|
|
11558
|
+
documentNode.diagnostics.map((diagnostic) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "butex-document2-widget__dev-diagnostic", children: formatDocument2Diagnostic(diagnostic, messages) }, `${diagnostic.path}-${diagnostic.message}`))
|
|
11559
|
+
] }) : null,
|
|
11560
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "LaTeX" }),
|
|
11561
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("pre", { children: latex }),
|
|
11562
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "AST" }),
|
|
11563
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("pre", { children: JSON.stringify(documentNode, null, 2) })
|
|
11564
|
+
] }) : null,
|
|
11565
|
+
selectedMath ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
11566
|
+
EquationDrawer,
|
|
11567
|
+
{
|
|
11568
|
+
session: selectedMath.session,
|
|
11569
|
+
reason: selectedMath.reason,
|
|
11570
|
+
mathMode: selectedMath.mathMode,
|
|
11571
|
+
canDelete: Boolean(selectedMath.tokenId),
|
|
11572
|
+
equationSide,
|
|
11573
|
+
uiLocale,
|
|
11574
|
+
onMathModeChange: (mode) => setSelectedMath((current) => current ? { ...current, mathMode: mode } : current),
|
|
11575
|
+
onClose: () => setSelectedMath(null),
|
|
11576
|
+
onSave: saveEquation,
|
|
11577
|
+
onDelete: deleteSelectedEquation
|
|
11578
|
+
}
|
|
11579
|
+
) : null
|
|
11580
|
+
] })
|
|
11581
|
+
}
|
|
11582
|
+
);
|
|
10798
11583
|
}
|
|
10799
11584
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10800
11585
|
0 && (module.exports = {
|