@drghaliasri/butex 5.4.6 → 5.5.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 +3 -2
- package/dist/document.js +2 -1
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +2 -1
- package/dist/document.mjs.map +1 -1
- package/dist/document2.d.mts +20 -2
- package/dist/document2.d.ts +20 -2
- package/dist/document2.js +184 -22
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +183 -22
- package/dist/document2.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.global.js +137 -37
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +137 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +137 -37
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +171 -39
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +171 -39
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.d.mts +23 -3
- package/dist/react-document2.d.ts +23 -3
- package/dist/react-document2.js +690 -95
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +736 -141
- package/dist/react-document2.mjs.map +1 -1
- package/dist/react.d.mts +1 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +171 -39
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +171 -39
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -4921,7 +4921,8 @@ ${BUTEX_FONT_FACE_CSS}
|
|
|
4921
4921
|
transition: box-shadow 0.15s ease, border-color 0.15s ease;
|
|
4922
4922
|
}
|
|
4923
4923
|
|
|
4924
|
-
.surface:focus
|
|
4924
|
+
.surface:focus,
|
|
4925
|
+
.surface.surface--typing-focus {
|
|
4925
4926
|
border-color: var(--butex-focus-border, rgba(13, 148, 136, 0.45));
|
|
4926
4927
|
box-shadow: 0 0 0 3px var(--butex-focus-shadow, rgba(13, 148, 136, 0.12));
|
|
4927
4928
|
}
|
|
@@ -5123,7 +5124,7 @@ function injectBuTeXEditorStyles(doc) {
|
|
|
5123
5124
|
|
|
5124
5125
|
// src/editor/runtime.ts
|
|
5125
5126
|
function createEditorRuntime(options) {
|
|
5126
|
-
const { surfaceEl } = options;
|
|
5127
|
+
const { surfaceEl, inputEl } = options;
|
|
5127
5128
|
const buttonElements = options.buttonElements ?? {};
|
|
5128
5129
|
const outsidePointerIgnoreSelectors = options.outsidePointerIgnoreSelectors ?? [];
|
|
5129
5130
|
let session = options.initialSession ?? createStarterSession();
|
|
@@ -5137,6 +5138,23 @@ function createEditorRuntime(options) {
|
|
|
5137
5138
|
let dragSelecting = false;
|
|
5138
5139
|
let dragChainId = null;
|
|
5139
5140
|
let dragChanged = false;
|
|
5141
|
+
let composingInput = false;
|
|
5142
|
+
let pendingCompositionText = null;
|
|
5143
|
+
function resetInputElement() {
|
|
5144
|
+
if (!inputEl) {
|
|
5145
|
+
return;
|
|
5146
|
+
}
|
|
5147
|
+
inputEl.value = "";
|
|
5148
|
+
}
|
|
5149
|
+
function focusInput() {
|
|
5150
|
+
if (!inputEl) {
|
|
5151
|
+
surfaceEl.focus();
|
|
5152
|
+
return;
|
|
5153
|
+
}
|
|
5154
|
+
inputEl.focus({ preventScroll: true });
|
|
5155
|
+
const end = inputEl.value.length;
|
|
5156
|
+
inputEl.setSelectionRange(end, end);
|
|
5157
|
+
}
|
|
5140
5158
|
function notifySessionChange() {
|
|
5141
5159
|
options.onSessionChange?.(session);
|
|
5142
5160
|
}
|
|
@@ -5401,7 +5419,7 @@ function createEditorRuntime(options) {
|
|
|
5401
5419
|
event.preventDefault();
|
|
5402
5420
|
event.stopPropagation();
|
|
5403
5421
|
startDragSelection(chainId, index);
|
|
5404
|
-
|
|
5422
|
+
focusInput();
|
|
5405
5423
|
});
|
|
5406
5424
|
slot.addEventListener("click", (event) => {
|
|
5407
5425
|
if (dragChanged) {
|
|
@@ -5411,7 +5429,7 @@ function createEditorRuntime(options) {
|
|
|
5411
5429
|
return;
|
|
5412
5430
|
}
|
|
5413
5431
|
applyTransient((prev) => setCaret(prev, chainId, index));
|
|
5414
|
-
|
|
5432
|
+
focusInput();
|
|
5415
5433
|
});
|
|
5416
5434
|
if (session.caret.chainId === chainId && session.caret.index === index) {
|
|
5417
5435
|
const caret = document.createElement("span");
|
|
@@ -5443,7 +5461,7 @@ function createEditorRuntime(options) {
|
|
|
5443
5461
|
event.preventDefault();
|
|
5444
5462
|
event.stopPropagation();
|
|
5445
5463
|
startDragSelection(chainId, indexInChain);
|
|
5446
|
-
|
|
5464
|
+
focusInput();
|
|
5447
5465
|
});
|
|
5448
5466
|
nodeEl.addEventListener("click", (event) => {
|
|
5449
5467
|
if (dragChanged) {
|
|
@@ -5454,7 +5472,7 @@ function createEditorRuntime(options) {
|
|
|
5454
5472
|
}
|
|
5455
5473
|
event.stopPropagation();
|
|
5456
5474
|
applyTransient((prev) => selectNode(prev, node.id));
|
|
5457
|
-
|
|
5475
|
+
focusInput();
|
|
5458
5476
|
});
|
|
5459
5477
|
const body = document.createElement("span");
|
|
5460
5478
|
body.className = "node-body";
|
|
@@ -5489,7 +5507,7 @@ function createEditorRuntime(options) {
|
|
|
5489
5507
|
const activeTree = session[activeTreeKey(session.activeSide)];
|
|
5490
5508
|
surfaceEl.appendChild(buildChain(activeTree));
|
|
5491
5509
|
if (initialKeyboardFocusPending) {
|
|
5492
|
-
requestAnimationFrame(
|
|
5510
|
+
requestAnimationFrame(focusInput);
|
|
5493
5511
|
initialKeyboardFocusPending = false;
|
|
5494
5512
|
}
|
|
5495
5513
|
notifySessionChange();
|
|
@@ -5527,7 +5545,7 @@ function createEditorRuntime(options) {
|
|
|
5527
5545
|
}
|
|
5528
5546
|
session = restored;
|
|
5529
5547
|
render();
|
|
5530
|
-
|
|
5548
|
+
focusInput();
|
|
5531
5549
|
}
|
|
5532
5550
|
function performRedo() {
|
|
5533
5551
|
const restored = restoreRedo(undoRedo, session);
|
|
@@ -5536,9 +5554,12 @@ function createEditorRuntime(options) {
|
|
|
5536
5554
|
}
|
|
5537
5555
|
session = restored;
|
|
5538
5556
|
render();
|
|
5539
|
-
|
|
5557
|
+
focusInput();
|
|
5540
5558
|
}
|
|
5541
5559
|
function onKeyDown(event) {
|
|
5560
|
+
if (event.isComposing || event.key === "Process" || event.keyCode === 229) {
|
|
5561
|
+
return;
|
|
5562
|
+
}
|
|
5542
5563
|
const shortcutMod = event.ctrlKey || event.metaKey;
|
|
5543
5564
|
const keyLower = typeof event.key === "string" ? event.key.toLowerCase() : "";
|
|
5544
5565
|
if (shortcutMod && !event.altKey && keyLower === "z") {
|
|
@@ -5637,6 +5658,70 @@ function createEditorRuntime(options) {
|
|
|
5637
5658
|
applyStructural((prev) => insertChar(prev, char));
|
|
5638
5659
|
}
|
|
5639
5660
|
}
|
|
5661
|
+
function onBeforeInput(event) {
|
|
5662
|
+
if (composingInput || event.isComposing) {
|
|
5663
|
+
return;
|
|
5664
|
+
}
|
|
5665
|
+
if (event.inputType === "deleteContentBackward") {
|
|
5666
|
+
event.preventDefault();
|
|
5667
|
+
applyStructural((prev) => deleteBackward(prev));
|
|
5668
|
+
resetInputElement();
|
|
5669
|
+
return;
|
|
5670
|
+
}
|
|
5671
|
+
if (event.inputType === "deleteContentForward") {
|
|
5672
|
+
event.preventDefault();
|
|
5673
|
+
applyStructural((prev) => deleteForward(prev));
|
|
5674
|
+
resetInputElement();
|
|
5675
|
+
}
|
|
5676
|
+
}
|
|
5677
|
+
function onInput(event) {
|
|
5678
|
+
if (!inputEl || composingInput) {
|
|
5679
|
+
return;
|
|
5680
|
+
}
|
|
5681
|
+
const inputEvent = event;
|
|
5682
|
+
const text = inputEvent.data ?? inputEl.value;
|
|
5683
|
+
resetInputElement();
|
|
5684
|
+
if (pendingCompositionText !== null && (inputEvent.inputType === "insertFromComposition" || text === pendingCompositionText)) {
|
|
5685
|
+
pendingCompositionText = null;
|
|
5686
|
+
return;
|
|
5687
|
+
}
|
|
5688
|
+
pendingCompositionText = null;
|
|
5689
|
+
if (inputEvent.inputType === "deleteContentBackward") {
|
|
5690
|
+
applyStructural((prev) => deleteBackward(prev));
|
|
5691
|
+
return;
|
|
5692
|
+
}
|
|
5693
|
+
if (inputEvent.inputType === "deleteContentForward") {
|
|
5694
|
+
applyStructural((prev) => deleteForward(prev));
|
|
5695
|
+
return;
|
|
5696
|
+
}
|
|
5697
|
+
if (text) {
|
|
5698
|
+
applyStructural((prev) => pasteText(prev, text));
|
|
5699
|
+
}
|
|
5700
|
+
}
|
|
5701
|
+
function onCompositionStart() {
|
|
5702
|
+
composingInput = true;
|
|
5703
|
+
}
|
|
5704
|
+
function onCompositionEnd(event) {
|
|
5705
|
+
if (!inputEl) {
|
|
5706
|
+
return;
|
|
5707
|
+
}
|
|
5708
|
+
composingInput = false;
|
|
5709
|
+
const text = event.data || inputEl.value;
|
|
5710
|
+
resetInputElement();
|
|
5711
|
+
if (text) {
|
|
5712
|
+
applyStructural((prev) => pasteText(prev, text));
|
|
5713
|
+
}
|
|
5714
|
+
pendingCompositionText = text || null;
|
|
5715
|
+
window.setTimeout(() => {
|
|
5716
|
+
pendingCompositionText = null;
|
|
5717
|
+
}, 0);
|
|
5718
|
+
}
|
|
5719
|
+
function onInputFocus() {
|
|
5720
|
+
surfaceEl.classList.add("surface--typing-focus");
|
|
5721
|
+
}
|
|
5722
|
+
function onInputBlur() {
|
|
5723
|
+
surfaceEl.classList.remove("surface--typing-focus");
|
|
5724
|
+
}
|
|
5640
5725
|
function isShortcutOnlyEvent(event) {
|
|
5641
5726
|
if (!(event.ctrlKey || event.metaKey) || event.altKey) {
|
|
5642
5727
|
return false;
|
|
@@ -5686,7 +5771,7 @@ function createEditorRuntime(options) {
|
|
|
5686
5771
|
}
|
|
5687
5772
|
event.preventDefault();
|
|
5688
5773
|
startDragSelection(resolved.chainId, resolved.slotIndex);
|
|
5689
|
-
|
|
5774
|
+
focusInput();
|
|
5690
5775
|
}
|
|
5691
5776
|
function onSurfaceClick(event) {
|
|
5692
5777
|
if (dragChanged) {
|
|
@@ -5703,7 +5788,7 @@ function createEditorRuntime(options) {
|
|
|
5703
5788
|
} else {
|
|
5704
5789
|
clearSelectionAndNodeHighlights();
|
|
5705
5790
|
}
|
|
5706
|
-
|
|
5791
|
+
focusInput();
|
|
5707
5792
|
}
|
|
5708
5793
|
function onDocumentPointerDown(event) {
|
|
5709
5794
|
const target = event.target;
|
|
@@ -5719,6 +5804,13 @@ function createEditorRuntime(options) {
|
|
|
5719
5804
|
clearSelectionAndNodeHighlights();
|
|
5720
5805
|
}
|
|
5721
5806
|
surfaceEl.addEventListener("keydown", onKeyDown);
|
|
5807
|
+
inputEl?.addEventListener("keydown", onKeyDown);
|
|
5808
|
+
inputEl?.addEventListener("beforeinput", onBeforeInput);
|
|
5809
|
+
inputEl?.addEventListener("input", onInput);
|
|
5810
|
+
inputEl?.addEventListener("compositionstart", onCompositionStart);
|
|
5811
|
+
inputEl?.addEventListener("compositionend", onCompositionEnd);
|
|
5812
|
+
inputEl?.addEventListener("focus", onInputFocus);
|
|
5813
|
+
inputEl?.addEventListener("blur", onInputBlur);
|
|
5722
5814
|
document.addEventListener("keydown", onDocumentKeyDown);
|
|
5723
5815
|
document.addEventListener("mouseup", endDragSelection);
|
|
5724
5816
|
document.addEventListener("mouseleave", endDragSelection);
|
|
@@ -5730,6 +5822,13 @@ function createEditorRuntime(options) {
|
|
|
5730
5822
|
render,
|
|
5731
5823
|
destroy: () => {
|
|
5732
5824
|
surfaceEl.removeEventListener("keydown", onKeyDown);
|
|
5825
|
+
inputEl?.removeEventListener("keydown", onKeyDown);
|
|
5826
|
+
inputEl?.removeEventListener("beforeinput", onBeforeInput);
|
|
5827
|
+
inputEl?.removeEventListener("input", onInput);
|
|
5828
|
+
inputEl?.removeEventListener("compositionstart", onCompositionStart);
|
|
5829
|
+
inputEl?.removeEventListener("compositionend", onCompositionEnd);
|
|
5830
|
+
inputEl?.removeEventListener("focus", onInputFocus);
|
|
5831
|
+
inputEl?.removeEventListener("blur", onInputBlur);
|
|
5733
5832
|
document.removeEventListener("keydown", onDocumentKeyDown);
|
|
5734
5833
|
document.removeEventListener("mouseup", endDragSelection);
|
|
5735
5834
|
document.removeEventListener("mouseleave", endDragSelection);
|
|
@@ -5750,6 +5849,7 @@ function createEditorRuntime(options) {
|
|
|
5750
5849
|
uiLocale = locale;
|
|
5751
5850
|
render();
|
|
5752
5851
|
},
|
|
5852
|
+
focusInput,
|
|
5753
5853
|
performUndo,
|
|
5754
5854
|
performRedo,
|
|
5755
5855
|
performCopy,
|
|
@@ -5757,27 +5857,27 @@ function createEditorRuntime(options) {
|
|
|
5757
5857
|
performPaste,
|
|
5758
5858
|
toggleSide: () => {
|
|
5759
5859
|
applyTransient((prev) => switchSide(prev));
|
|
5760
|
-
|
|
5860
|
+
focusInput();
|
|
5761
5861
|
},
|
|
5762
5862
|
toggleSplitLeafTyping: () => {
|
|
5763
5863
|
applyStructural((prev) => setSplitLeafTyping(prev, !prev.splitLeafTyping));
|
|
5764
|
-
|
|
5864
|
+
focusInput();
|
|
5765
5865
|
},
|
|
5766
5866
|
toggleArabicReverseNumberTyping: () => {
|
|
5767
5867
|
applyStructural((prev) => setArabicReverseNumberTyping(prev, !prev.arabicReverseNumberTyping));
|
|
5768
|
-
|
|
5868
|
+
focusInput();
|
|
5769
5869
|
},
|
|
5770
5870
|
toggleTakweenCharacterFont: () => {
|
|
5771
5871
|
applyTransient((prev) => toggleTakweenCharacterFont(prev));
|
|
5772
|
-
|
|
5872
|
+
focusInput();
|
|
5773
5873
|
},
|
|
5774
5874
|
setCurrentCharacterFont: (fontId) => {
|
|
5775
5875
|
applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
|
|
5776
|
-
|
|
5876
|
+
focusInput();
|
|
5777
5877
|
},
|
|
5778
5878
|
setCurrentDigitForm: (digitForm) => {
|
|
5779
5879
|
applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
|
|
5780
|
-
|
|
5880
|
+
focusInput();
|
|
5781
5881
|
},
|
|
5782
5882
|
insertDelimiterByKind: (kind) => {
|
|
5783
5883
|
if (kind === "paren") {
|
|
@@ -5787,79 +5887,79 @@ function createEditorRuntime(options) {
|
|
|
5787
5887
|
} else {
|
|
5788
5888
|
applyStructural((prev) => insertDelimiterPair(prev, "\\left\\{", "\\right\\}"));
|
|
5789
5889
|
}
|
|
5790
|
-
|
|
5890
|
+
focusInput();
|
|
5791
5891
|
},
|
|
5792
5892
|
insertFraction: () => {
|
|
5793
5893
|
applyStructural((prev) => insertFraction(prev));
|
|
5794
|
-
|
|
5894
|
+
focusInput();
|
|
5795
5895
|
},
|
|
5796
5896
|
insertFirstDerivative: () => {
|
|
5797
5897
|
applyStructural((prev) => insertFirstDerivative(prev));
|
|
5798
|
-
|
|
5898
|
+
focusInput();
|
|
5799
5899
|
},
|
|
5800
5900
|
insertSecondDerivative: () => {
|
|
5801
5901
|
applyStructural((prev) => insertSecondDerivative(prev));
|
|
5802
|
-
|
|
5902
|
+
focusInput();
|
|
5803
5903
|
},
|
|
5804
5904
|
insertMatrixEnv: (style, rows, columns) => {
|
|
5805
5905
|
applyStructural((prev) => insertMatrixEnv(prev, style, rows, columns));
|
|
5806
|
-
|
|
5906
|
+
focusInput();
|
|
5807
5907
|
},
|
|
5808
5908
|
insertArrayEnv: (rows, columns) => {
|
|
5809
5909
|
applyStructural((prev) => insertArrayEnv(prev, rows, columns));
|
|
5810
|
-
|
|
5910
|
+
focusInput();
|
|
5811
5911
|
},
|
|
5812
5912
|
insertAlignedEnv: (rows, columns) => {
|
|
5813
5913
|
applyStructural((prev) => insertAlignedEnv(prev, rows, columns));
|
|
5814
|
-
|
|
5914
|
+
focusInput();
|
|
5815
5915
|
},
|
|
5816
5916
|
insertSqrt: () => {
|
|
5817
5917
|
applyStructural((prev) => insertSqrt(prev));
|
|
5818
|
-
|
|
5918
|
+
focusInput();
|
|
5819
5919
|
},
|
|
5820
5920
|
insertOverset: () => {
|
|
5821
5921
|
applyStructural((prev) => insertOverset(prev));
|
|
5822
|
-
|
|
5922
|
+
focusInput();
|
|
5823
5923
|
},
|
|
5824
5924
|
insertUnderset: () => {
|
|
5825
5925
|
applyStructural((prev) => insertUnderset(prev));
|
|
5826
|
-
|
|
5926
|
+
focusInput();
|
|
5827
5927
|
},
|
|
5828
5928
|
insertLimitsSeriesTemplate: (commandId) => {
|
|
5829
5929
|
applyStructural((prev) => insertLimitsSeriesTemplate(prev, commandId));
|
|
5830
|
-
|
|
5930
|
+
focusInput();
|
|
5831
5931
|
},
|
|
5832
5932
|
insertAccentPair: () => {
|
|
5833
5933
|
applyStructural((prev) => insertAccentPair(prev));
|
|
5834
|
-
|
|
5934
|
+
focusInput();
|
|
5835
5935
|
},
|
|
5836
5936
|
insertAccent: (accentId) => {
|
|
5837
5937
|
applyStructural((prev) => insertAccent(prev, accentId));
|
|
5838
|
-
|
|
5938
|
+
focusInput();
|
|
5839
5939
|
},
|
|
5840
5940
|
insertAtomicCommand: (commandId) => {
|
|
5841
5941
|
applyStructural((prev) => insertAtomicCommand(prev, commandId));
|
|
5842
|
-
|
|
5942
|
+
focusInput();
|
|
5843
5943
|
},
|
|
5844
5944
|
insertAtomicOperatorCommand: (commandId) => {
|
|
5845
5945
|
applyStructural((prev) => insertAtomicOperatorCommand(prev, commandId));
|
|
5846
|
-
|
|
5946
|
+
focusInput();
|
|
5847
5947
|
},
|
|
5848
5948
|
addSup: () => {
|
|
5849
5949
|
applyStructural((prev) => addSup(prev));
|
|
5850
|
-
|
|
5950
|
+
focusInput();
|
|
5851
5951
|
},
|
|
5852
5952
|
addSub: () => {
|
|
5853
5953
|
applyStructural((prev) => addSub(prev));
|
|
5854
|
-
|
|
5954
|
+
focusInput();
|
|
5855
5955
|
},
|
|
5856
5956
|
removeSup: () => {
|
|
5857
5957
|
applyStructural((prev) => removeSup(prev));
|
|
5858
|
-
|
|
5958
|
+
focusInput();
|
|
5859
5959
|
},
|
|
5860
5960
|
removeSub: () => {
|
|
5861
5961
|
applyStructural((prev) => removeSub(prev));
|
|
5862
|
-
|
|
5962
|
+
focusInput();
|
|
5863
5963
|
},
|
|
5864
5964
|
setMatrixEnvStyle: (style) => {
|
|
5865
5965
|
applyStructural((prev) => setMatrixEnvStyle(prev, style));
|
|
@@ -5881,7 +5981,7 @@ function createEditorRuntime(options) {
|
|
|
5881
5981
|
},
|
|
5882
5982
|
deleteStructure: () => {
|
|
5883
5983
|
applyStructural((prev) => deleteStructure(prev));
|
|
5884
|
-
|
|
5984
|
+
focusInput();
|
|
5885
5985
|
}
|
|
5886
5986
|
};
|
|
5887
5987
|
render();
|
|
@@ -6348,6 +6448,22 @@ var WIDGET_CHROME_CSS = `
|
|
|
6348
6448
|
padding: 10px 12px;
|
|
6349
6449
|
}
|
|
6350
6450
|
|
|
6451
|
+
.butex-widget .butex-editor-input-bridge {
|
|
6452
|
+
border: 0;
|
|
6453
|
+
font-size: 16px;
|
|
6454
|
+
height: 1px;
|
|
6455
|
+
margin: 0;
|
|
6456
|
+
max-height: 1px;
|
|
6457
|
+
min-height: 1px;
|
|
6458
|
+
opacity: 0;
|
|
6459
|
+
overflow: hidden;
|
|
6460
|
+
padding: 0;
|
|
6461
|
+
pointer-events: none;
|
|
6462
|
+
position: absolute;
|
|
6463
|
+
resize: none;
|
|
6464
|
+
width: 1px;
|
|
6465
|
+
}
|
|
6466
|
+
|
|
6351
6467
|
.butex-widget .toolbar {
|
|
6352
6468
|
display: flex;
|
|
6353
6469
|
flex-wrap: wrap;
|
|
@@ -7354,6 +7470,7 @@ var ButexEditor = forwardRef(
|
|
|
7354
7470
|
const messages = equationEditorMessages(uiLocale);
|
|
7355
7471
|
const wrapperRef = useRef(null);
|
|
7356
7472
|
const surfaceRef = useRef(null);
|
|
7473
|
+
const inputRef = useRef(null);
|
|
7357
7474
|
const mathOutputRef = useRef(null);
|
|
7358
7475
|
const renderErrorRef = useRef(null);
|
|
7359
7476
|
const latexLinesRef = useRef(null);
|
|
@@ -7465,6 +7582,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
7465
7582
|
}
|
|
7466
7583
|
const runtime = createEditorRuntime({
|
|
7467
7584
|
surfaceEl,
|
|
7585
|
+
inputEl: inputRef.current,
|
|
7468
7586
|
initialSession,
|
|
7469
7587
|
defaultSide,
|
|
7470
7588
|
uiLocale,
|
|
@@ -7506,7 +7624,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
7506
7624
|
} else {
|
|
7507
7625
|
runtime.render();
|
|
7508
7626
|
}
|
|
7509
|
-
|
|
7627
|
+
runtime.focusInput();
|
|
7510
7628
|
return () => {
|
|
7511
7629
|
runtime.destroy();
|
|
7512
7630
|
runtimeRef.current = null;
|
|
@@ -7520,7 +7638,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
7520
7638
|
}
|
|
7521
7639
|
}, [uiLocale]);
|
|
7522
7640
|
function focusSurface() {
|
|
7523
|
-
|
|
7641
|
+
runtimeRef.current?.focusInput();
|
|
7524
7642
|
}
|
|
7525
7643
|
function insertSelectedEnvironment(rows, columns) {
|
|
7526
7644
|
if (envPaletteMode === "array") {
|
|
@@ -8598,6 +8716,20 @@ ${arabic || currentMessages.empty}`;
|
|
|
8598
8716
|
"aria-label": messages.equationEditor
|
|
8599
8717
|
}
|
|
8600
8718
|
),
|
|
8719
|
+
/* @__PURE__ */ jsx(
|
|
8720
|
+
"textarea",
|
|
8721
|
+
{
|
|
8722
|
+
ref: inputRef,
|
|
8723
|
+
className: "butex-editor-input-bridge",
|
|
8724
|
+
"aria-label": messages.equationEditor,
|
|
8725
|
+
autoCapitalize: "none",
|
|
8726
|
+
autoComplete: "off",
|
|
8727
|
+
autoCorrect: "off",
|
|
8728
|
+
inputMode: "text",
|
|
8729
|
+
spellCheck: false,
|
|
8730
|
+
tabIndex: -1
|
|
8731
|
+
}
|
|
8732
|
+
),
|
|
8601
8733
|
/* @__PURE__ */ jsx("div", { ref: renderErrorRef, className: "error", hidden: true })
|
|
8602
8734
|
] }),
|
|
8603
8735
|
/* @__PURE__ */ jsx("section", { className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx("div", { ref: mathOutputRef, className: "preview-box" }) }),
|