@drghaliasri/butex 5.5.0 → 5.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/document.js +4 -3
- package/dist/document.js.map +1 -1
- package/dist/document.mjs +4 -3
- package/dist/document.mjs.map +1 -1
- package/dist/document2.js +12 -13
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +12 -13
- 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 +138 -38
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +138 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +138 -38
- package/dist/index.mjs.map +1 -1
- package/dist/react-document.js +174 -42
- package/dist/react-document.js.map +1 -1
- package/dist/react-document.mjs +174 -42
- package/dist/react-document.mjs.map +1 -1
- package/dist/react-document2.js +181 -51
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +181 -51
- 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 +172 -40
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +172 -40
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react-document2.mjs
CHANGED
|
@@ -522,7 +522,7 @@ var CommandNode = class extends BaseAstNode {
|
|
|
522
522
|
arabicLatex() {
|
|
523
523
|
const sup = this.superscript !== null ? this.superscript.arabicLatex() : "";
|
|
524
524
|
const sub = this.subscript !== null ? this.subscript.arabicLatex() : "";
|
|
525
|
-
const arabicName = this.name === "\\sqrt"
|
|
525
|
+
const arabicName = this.name === "\\sqrt" || this.name === "\\arabsqrt" ? "\\arsqrt" : this.name;
|
|
526
526
|
const content = renderCommandCore({
|
|
527
527
|
name: arabicName,
|
|
528
528
|
optionalArgs: this.optionalArgs,
|
|
@@ -2899,7 +2899,7 @@ function renderNodeArabic(node, options) {
|
|
|
2899
2899
|
return arabicScripts(node, content, options);
|
|
2900
2900
|
}
|
|
2901
2901
|
if (node.kind === "sqrt" && node.radicand) {
|
|
2902
|
-
const content = `\\
|
|
2902
|
+
const content = `\\arsqrt${optionalRootIndexArabic(node, options)}{${renderChainArabic(node.radicand, options)}}`;
|
|
2903
2903
|
return arabicScripts(node, content, options);
|
|
2904
2904
|
}
|
|
2905
2905
|
if (node.kind === "overset" && node.baseExpr) {
|
|
@@ -6400,7 +6400,8 @@ ${BUTEX_FONT_FACE_CSS}
|
|
|
6400
6400
|
transition: box-shadow 0.15s ease, border-color 0.15s ease;
|
|
6401
6401
|
}
|
|
6402
6402
|
|
|
6403
|
-
.surface:focus
|
|
6403
|
+
.surface:focus,
|
|
6404
|
+
.surface.surface--typing-focus {
|
|
6404
6405
|
border-color: var(--butex-focus-border, rgba(13, 148, 136, 0.45));
|
|
6405
6406
|
box-shadow: 0 0 0 3px var(--butex-focus-shadow, rgba(13, 148, 136, 0.12));
|
|
6406
6407
|
}
|
|
@@ -6602,7 +6603,7 @@ function injectBuTeXEditorStyles(doc) {
|
|
|
6602
6603
|
|
|
6603
6604
|
// src/editor/runtime.ts
|
|
6604
6605
|
function createEditorRuntime(options) {
|
|
6605
|
-
const { surfaceEl } = options;
|
|
6606
|
+
const { surfaceEl, inputEl } = options;
|
|
6606
6607
|
const buttonElements = options.buttonElements ?? {};
|
|
6607
6608
|
const outsidePointerIgnoreSelectors = options.outsidePointerIgnoreSelectors ?? [];
|
|
6608
6609
|
let session = options.initialSession ?? createStarterSession();
|
|
@@ -6616,6 +6617,23 @@ function createEditorRuntime(options) {
|
|
|
6616
6617
|
let dragSelecting = false;
|
|
6617
6618
|
let dragChainId = null;
|
|
6618
6619
|
let dragChanged = false;
|
|
6620
|
+
let composingInput = false;
|
|
6621
|
+
let pendingCompositionText = null;
|
|
6622
|
+
function resetInputElement() {
|
|
6623
|
+
if (!inputEl) {
|
|
6624
|
+
return;
|
|
6625
|
+
}
|
|
6626
|
+
inputEl.value = "";
|
|
6627
|
+
}
|
|
6628
|
+
function focusInput() {
|
|
6629
|
+
if (!inputEl) {
|
|
6630
|
+
surfaceEl.focus();
|
|
6631
|
+
return;
|
|
6632
|
+
}
|
|
6633
|
+
inputEl.focus({ preventScroll: true });
|
|
6634
|
+
const end = inputEl.value.length;
|
|
6635
|
+
inputEl.setSelectionRange(end, end);
|
|
6636
|
+
}
|
|
6619
6637
|
function notifySessionChange() {
|
|
6620
6638
|
options.onSessionChange?.(session);
|
|
6621
6639
|
}
|
|
@@ -6880,7 +6898,7 @@ function createEditorRuntime(options) {
|
|
|
6880
6898
|
event.preventDefault();
|
|
6881
6899
|
event.stopPropagation();
|
|
6882
6900
|
startDragSelection(chainId, index);
|
|
6883
|
-
|
|
6901
|
+
focusInput();
|
|
6884
6902
|
});
|
|
6885
6903
|
slot.addEventListener("click", (event) => {
|
|
6886
6904
|
if (dragChanged) {
|
|
@@ -6890,7 +6908,7 @@ function createEditorRuntime(options) {
|
|
|
6890
6908
|
return;
|
|
6891
6909
|
}
|
|
6892
6910
|
applyTransient((prev) => setCaret(prev, chainId, index));
|
|
6893
|
-
|
|
6911
|
+
focusInput();
|
|
6894
6912
|
});
|
|
6895
6913
|
if (session.caret.chainId === chainId && session.caret.index === index) {
|
|
6896
6914
|
const caret = document.createElement("span");
|
|
@@ -6922,7 +6940,7 @@ function createEditorRuntime(options) {
|
|
|
6922
6940
|
event.preventDefault();
|
|
6923
6941
|
event.stopPropagation();
|
|
6924
6942
|
startDragSelection(chainId, indexInChain);
|
|
6925
|
-
|
|
6943
|
+
focusInput();
|
|
6926
6944
|
});
|
|
6927
6945
|
nodeEl.addEventListener("click", (event) => {
|
|
6928
6946
|
if (dragChanged) {
|
|
@@ -6933,7 +6951,7 @@ function createEditorRuntime(options) {
|
|
|
6933
6951
|
}
|
|
6934
6952
|
event.stopPropagation();
|
|
6935
6953
|
applyTransient((prev) => selectNode(prev, node.id));
|
|
6936
|
-
|
|
6954
|
+
focusInput();
|
|
6937
6955
|
});
|
|
6938
6956
|
const body = document.createElement("span");
|
|
6939
6957
|
body.className = "node-body";
|
|
@@ -6968,7 +6986,7 @@ function createEditorRuntime(options) {
|
|
|
6968
6986
|
const activeTree = session[activeTreeKey(session.activeSide)];
|
|
6969
6987
|
surfaceEl.appendChild(buildChain(activeTree));
|
|
6970
6988
|
if (initialKeyboardFocusPending) {
|
|
6971
|
-
requestAnimationFrame(
|
|
6989
|
+
requestAnimationFrame(focusInput);
|
|
6972
6990
|
initialKeyboardFocusPending = false;
|
|
6973
6991
|
}
|
|
6974
6992
|
notifySessionChange();
|
|
@@ -7006,7 +7024,7 @@ function createEditorRuntime(options) {
|
|
|
7006
7024
|
}
|
|
7007
7025
|
session = restored;
|
|
7008
7026
|
render();
|
|
7009
|
-
|
|
7027
|
+
focusInput();
|
|
7010
7028
|
}
|
|
7011
7029
|
function performRedo() {
|
|
7012
7030
|
const restored = restoreRedo(undoRedo, session);
|
|
@@ -7015,9 +7033,12 @@ function createEditorRuntime(options) {
|
|
|
7015
7033
|
}
|
|
7016
7034
|
session = restored;
|
|
7017
7035
|
render();
|
|
7018
|
-
|
|
7036
|
+
focusInput();
|
|
7019
7037
|
}
|
|
7020
7038
|
function onKeyDown(event) {
|
|
7039
|
+
if (event.isComposing || event.key === "Process" || event.keyCode === 229) {
|
|
7040
|
+
return;
|
|
7041
|
+
}
|
|
7021
7042
|
const shortcutMod = event.ctrlKey || event.metaKey;
|
|
7022
7043
|
const keyLower = typeof event.key === "string" ? event.key.toLowerCase() : "";
|
|
7023
7044
|
if (shortcutMod && !event.altKey && keyLower === "z") {
|
|
@@ -7116,6 +7137,70 @@ function createEditorRuntime(options) {
|
|
|
7116
7137
|
applyStructural((prev) => insertChar(prev, char));
|
|
7117
7138
|
}
|
|
7118
7139
|
}
|
|
7140
|
+
function onBeforeInput(event) {
|
|
7141
|
+
if (composingInput || event.isComposing) {
|
|
7142
|
+
return;
|
|
7143
|
+
}
|
|
7144
|
+
if (event.inputType === "deleteContentBackward") {
|
|
7145
|
+
event.preventDefault();
|
|
7146
|
+
applyStructural((prev) => deleteBackward(prev));
|
|
7147
|
+
resetInputElement();
|
|
7148
|
+
return;
|
|
7149
|
+
}
|
|
7150
|
+
if (event.inputType === "deleteContentForward") {
|
|
7151
|
+
event.preventDefault();
|
|
7152
|
+
applyStructural((prev) => deleteForward(prev));
|
|
7153
|
+
resetInputElement();
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
function onInput(event) {
|
|
7157
|
+
if (!inputEl || composingInput) {
|
|
7158
|
+
return;
|
|
7159
|
+
}
|
|
7160
|
+
const inputEvent = event;
|
|
7161
|
+
const text = inputEvent.data ?? inputEl.value;
|
|
7162
|
+
resetInputElement();
|
|
7163
|
+
if (pendingCompositionText !== null && (inputEvent.inputType === "insertFromComposition" || text === pendingCompositionText)) {
|
|
7164
|
+
pendingCompositionText = null;
|
|
7165
|
+
return;
|
|
7166
|
+
}
|
|
7167
|
+
pendingCompositionText = null;
|
|
7168
|
+
if (inputEvent.inputType === "deleteContentBackward") {
|
|
7169
|
+
applyStructural((prev) => deleteBackward(prev));
|
|
7170
|
+
return;
|
|
7171
|
+
}
|
|
7172
|
+
if (inputEvent.inputType === "deleteContentForward") {
|
|
7173
|
+
applyStructural((prev) => deleteForward(prev));
|
|
7174
|
+
return;
|
|
7175
|
+
}
|
|
7176
|
+
if (text) {
|
|
7177
|
+
applyStructural((prev) => pasteText(prev, text));
|
|
7178
|
+
}
|
|
7179
|
+
}
|
|
7180
|
+
function onCompositionStart() {
|
|
7181
|
+
composingInput = true;
|
|
7182
|
+
}
|
|
7183
|
+
function onCompositionEnd(event) {
|
|
7184
|
+
if (!inputEl) {
|
|
7185
|
+
return;
|
|
7186
|
+
}
|
|
7187
|
+
composingInput = false;
|
|
7188
|
+
const text = event.data || inputEl.value;
|
|
7189
|
+
resetInputElement();
|
|
7190
|
+
if (text) {
|
|
7191
|
+
applyStructural((prev) => pasteText(prev, text));
|
|
7192
|
+
}
|
|
7193
|
+
pendingCompositionText = text || null;
|
|
7194
|
+
window.setTimeout(() => {
|
|
7195
|
+
pendingCompositionText = null;
|
|
7196
|
+
}, 0);
|
|
7197
|
+
}
|
|
7198
|
+
function onInputFocus() {
|
|
7199
|
+
surfaceEl.classList.add("surface--typing-focus");
|
|
7200
|
+
}
|
|
7201
|
+
function onInputBlur() {
|
|
7202
|
+
surfaceEl.classList.remove("surface--typing-focus");
|
|
7203
|
+
}
|
|
7119
7204
|
function isShortcutOnlyEvent(event) {
|
|
7120
7205
|
if (!(event.ctrlKey || event.metaKey) || event.altKey) {
|
|
7121
7206
|
return false;
|
|
@@ -7165,7 +7250,7 @@ function createEditorRuntime(options) {
|
|
|
7165
7250
|
}
|
|
7166
7251
|
event.preventDefault();
|
|
7167
7252
|
startDragSelection(resolved.chainId, resolved.slotIndex);
|
|
7168
|
-
|
|
7253
|
+
focusInput();
|
|
7169
7254
|
}
|
|
7170
7255
|
function onSurfaceClick(event) {
|
|
7171
7256
|
if (dragChanged) {
|
|
@@ -7182,7 +7267,7 @@ function createEditorRuntime(options) {
|
|
|
7182
7267
|
} else {
|
|
7183
7268
|
clearSelectionAndNodeHighlights();
|
|
7184
7269
|
}
|
|
7185
|
-
|
|
7270
|
+
focusInput();
|
|
7186
7271
|
}
|
|
7187
7272
|
function onDocumentPointerDown(event) {
|
|
7188
7273
|
const target = event.target;
|
|
@@ -7198,6 +7283,13 @@ function createEditorRuntime(options) {
|
|
|
7198
7283
|
clearSelectionAndNodeHighlights();
|
|
7199
7284
|
}
|
|
7200
7285
|
surfaceEl.addEventListener("keydown", onKeyDown);
|
|
7286
|
+
inputEl?.addEventListener("keydown", onKeyDown);
|
|
7287
|
+
inputEl?.addEventListener("beforeinput", onBeforeInput);
|
|
7288
|
+
inputEl?.addEventListener("input", onInput);
|
|
7289
|
+
inputEl?.addEventListener("compositionstart", onCompositionStart);
|
|
7290
|
+
inputEl?.addEventListener("compositionend", onCompositionEnd);
|
|
7291
|
+
inputEl?.addEventListener("focus", onInputFocus);
|
|
7292
|
+
inputEl?.addEventListener("blur", onInputBlur);
|
|
7201
7293
|
document.addEventListener("keydown", onDocumentKeyDown);
|
|
7202
7294
|
document.addEventListener("mouseup", endDragSelection);
|
|
7203
7295
|
document.addEventListener("mouseleave", endDragSelection);
|
|
@@ -7209,6 +7301,13 @@ function createEditorRuntime(options) {
|
|
|
7209
7301
|
render,
|
|
7210
7302
|
destroy: () => {
|
|
7211
7303
|
surfaceEl.removeEventListener("keydown", onKeyDown);
|
|
7304
|
+
inputEl?.removeEventListener("keydown", onKeyDown);
|
|
7305
|
+
inputEl?.removeEventListener("beforeinput", onBeforeInput);
|
|
7306
|
+
inputEl?.removeEventListener("input", onInput);
|
|
7307
|
+
inputEl?.removeEventListener("compositionstart", onCompositionStart);
|
|
7308
|
+
inputEl?.removeEventListener("compositionend", onCompositionEnd);
|
|
7309
|
+
inputEl?.removeEventListener("focus", onInputFocus);
|
|
7310
|
+
inputEl?.removeEventListener("blur", onInputBlur);
|
|
7212
7311
|
document.removeEventListener("keydown", onDocumentKeyDown);
|
|
7213
7312
|
document.removeEventListener("mouseup", endDragSelection);
|
|
7214
7313
|
document.removeEventListener("mouseleave", endDragSelection);
|
|
@@ -7229,6 +7328,7 @@ function createEditorRuntime(options) {
|
|
|
7229
7328
|
uiLocale = locale;
|
|
7230
7329
|
render();
|
|
7231
7330
|
},
|
|
7331
|
+
focusInput,
|
|
7232
7332
|
performUndo,
|
|
7233
7333
|
performRedo,
|
|
7234
7334
|
performCopy,
|
|
@@ -7236,27 +7336,27 @@ function createEditorRuntime(options) {
|
|
|
7236
7336
|
performPaste,
|
|
7237
7337
|
toggleSide: () => {
|
|
7238
7338
|
applyTransient((prev) => switchSide(prev));
|
|
7239
|
-
|
|
7339
|
+
focusInput();
|
|
7240
7340
|
},
|
|
7241
7341
|
toggleSplitLeafTyping: () => {
|
|
7242
7342
|
applyStructural((prev) => setSplitLeafTyping(prev, !prev.splitLeafTyping));
|
|
7243
|
-
|
|
7343
|
+
focusInput();
|
|
7244
7344
|
},
|
|
7245
7345
|
toggleArabicReverseNumberTyping: () => {
|
|
7246
7346
|
applyStructural((prev) => setArabicReverseNumberTyping(prev, !prev.arabicReverseNumberTyping));
|
|
7247
|
-
|
|
7347
|
+
focusInput();
|
|
7248
7348
|
},
|
|
7249
7349
|
toggleTakweenCharacterFont: () => {
|
|
7250
7350
|
applyTransient((prev) => toggleTakweenCharacterFont(prev));
|
|
7251
|
-
|
|
7351
|
+
focusInput();
|
|
7252
7352
|
},
|
|
7253
7353
|
setCurrentCharacterFont: (fontId) => {
|
|
7254
7354
|
applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
|
|
7255
|
-
|
|
7355
|
+
focusInput();
|
|
7256
7356
|
},
|
|
7257
7357
|
setCurrentDigitForm: (digitForm) => {
|
|
7258
7358
|
applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
|
|
7259
|
-
|
|
7359
|
+
focusInput();
|
|
7260
7360
|
},
|
|
7261
7361
|
insertDelimiterByKind: (kind) => {
|
|
7262
7362
|
if (kind === "paren") {
|
|
@@ -7266,79 +7366,79 @@ function createEditorRuntime(options) {
|
|
|
7266
7366
|
} else {
|
|
7267
7367
|
applyStructural((prev) => insertDelimiterPair(prev, "\\left\\{", "\\right\\}"));
|
|
7268
7368
|
}
|
|
7269
|
-
|
|
7369
|
+
focusInput();
|
|
7270
7370
|
},
|
|
7271
7371
|
insertFraction: () => {
|
|
7272
7372
|
applyStructural((prev) => insertFraction(prev));
|
|
7273
|
-
|
|
7373
|
+
focusInput();
|
|
7274
7374
|
},
|
|
7275
7375
|
insertFirstDerivative: () => {
|
|
7276
7376
|
applyStructural((prev) => insertFirstDerivative(prev));
|
|
7277
|
-
|
|
7377
|
+
focusInput();
|
|
7278
7378
|
},
|
|
7279
7379
|
insertSecondDerivative: () => {
|
|
7280
7380
|
applyStructural((prev) => insertSecondDerivative(prev));
|
|
7281
|
-
|
|
7381
|
+
focusInput();
|
|
7282
7382
|
},
|
|
7283
7383
|
insertMatrixEnv: (style, rows, columns) => {
|
|
7284
7384
|
applyStructural((prev) => insertMatrixEnv(prev, style, rows, columns));
|
|
7285
|
-
|
|
7385
|
+
focusInput();
|
|
7286
7386
|
},
|
|
7287
7387
|
insertArrayEnv: (rows, columns) => {
|
|
7288
7388
|
applyStructural((prev) => insertArrayEnv(prev, rows, columns));
|
|
7289
|
-
|
|
7389
|
+
focusInput();
|
|
7290
7390
|
},
|
|
7291
7391
|
insertAlignedEnv: (rows, columns) => {
|
|
7292
7392
|
applyStructural((prev) => insertAlignedEnv(prev, rows, columns));
|
|
7293
|
-
|
|
7393
|
+
focusInput();
|
|
7294
7394
|
},
|
|
7295
7395
|
insertSqrt: () => {
|
|
7296
7396
|
applyStructural((prev) => insertSqrt(prev));
|
|
7297
|
-
|
|
7397
|
+
focusInput();
|
|
7298
7398
|
},
|
|
7299
7399
|
insertOverset: () => {
|
|
7300
7400
|
applyStructural((prev) => insertOverset(prev));
|
|
7301
|
-
|
|
7401
|
+
focusInput();
|
|
7302
7402
|
},
|
|
7303
7403
|
insertUnderset: () => {
|
|
7304
7404
|
applyStructural((prev) => insertUnderset(prev));
|
|
7305
|
-
|
|
7405
|
+
focusInput();
|
|
7306
7406
|
},
|
|
7307
7407
|
insertLimitsSeriesTemplate: (commandId) => {
|
|
7308
7408
|
applyStructural((prev) => insertLimitsSeriesTemplate(prev, commandId));
|
|
7309
|
-
|
|
7409
|
+
focusInput();
|
|
7310
7410
|
},
|
|
7311
7411
|
insertAccentPair: () => {
|
|
7312
7412
|
applyStructural((prev) => insertAccentPair(prev));
|
|
7313
|
-
|
|
7413
|
+
focusInput();
|
|
7314
7414
|
},
|
|
7315
7415
|
insertAccent: (accentId) => {
|
|
7316
7416
|
applyStructural((prev) => insertAccent(prev, accentId));
|
|
7317
|
-
|
|
7417
|
+
focusInput();
|
|
7318
7418
|
},
|
|
7319
7419
|
insertAtomicCommand: (commandId) => {
|
|
7320
7420
|
applyStructural((prev) => insertAtomicCommand(prev, commandId));
|
|
7321
|
-
|
|
7421
|
+
focusInput();
|
|
7322
7422
|
},
|
|
7323
7423
|
insertAtomicOperatorCommand: (commandId) => {
|
|
7324
7424
|
applyStructural((prev) => insertAtomicOperatorCommand(prev, commandId));
|
|
7325
|
-
|
|
7425
|
+
focusInput();
|
|
7326
7426
|
},
|
|
7327
7427
|
addSup: () => {
|
|
7328
7428
|
applyStructural((prev) => addSup(prev));
|
|
7329
|
-
|
|
7429
|
+
focusInput();
|
|
7330
7430
|
},
|
|
7331
7431
|
addSub: () => {
|
|
7332
7432
|
applyStructural((prev) => addSub(prev));
|
|
7333
|
-
|
|
7433
|
+
focusInput();
|
|
7334
7434
|
},
|
|
7335
7435
|
removeSup: () => {
|
|
7336
7436
|
applyStructural((prev) => removeSup(prev));
|
|
7337
|
-
|
|
7437
|
+
focusInput();
|
|
7338
7438
|
},
|
|
7339
7439
|
removeSub: () => {
|
|
7340
7440
|
applyStructural((prev) => removeSub(prev));
|
|
7341
|
-
|
|
7441
|
+
focusInput();
|
|
7342
7442
|
},
|
|
7343
7443
|
setMatrixEnvStyle: (style) => {
|
|
7344
7444
|
applyStructural((prev) => setMatrixEnvStyle(prev, style));
|
|
@@ -7360,7 +7460,7 @@ function createEditorRuntime(options) {
|
|
|
7360
7460
|
},
|
|
7361
7461
|
deleteStructure: () => {
|
|
7362
7462
|
applyStructural((prev) => deleteStructure(prev));
|
|
7363
|
-
|
|
7463
|
+
focusInput();
|
|
7364
7464
|
}
|
|
7365
7465
|
};
|
|
7366
7466
|
render();
|
|
@@ -7622,7 +7722,7 @@ function commandToEditorNode(node) {
|
|
|
7622
7722
|
}
|
|
7623
7723
|
return { editable: true, node: frac };
|
|
7624
7724
|
}
|
|
7625
|
-
if ((node.name === "\\sqrt" || node.name === "\\arabsqrt") && node.mandatoryArgs.length >= 1) {
|
|
7725
|
+
if ((node.name === "\\sqrt" || node.name === "\\arabsqrt" || node.name === "\\arsqrt") && node.mandatoryArgs.length >= 1) {
|
|
7626
7726
|
const sqrt = createSqrtNode();
|
|
7627
7727
|
const radicand = chainToEditorChain(node.mandatoryArgs[0]);
|
|
7628
7728
|
if (!radicand.editable) {
|
|
@@ -8758,7 +8858,7 @@ function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
|
8758
8858
|
\usepackage{bidi}
|
|
8759
8859
|
\usepackage{multirow}
|
|
8760
8860
|
\usepackage{booktabs}
|
|
8761
|
-
\usepackage{graphicx} % For \
|
|
8861
|
+
\usepackage{graphicx} % For \reflectbox
|
|
8762
8862
|
\usepackage{xcolor}
|
|
8763
8863
|
\usepackage{tikz}
|
|
8764
8864
|
\usepackage{tcolorbox} % For tcolorbox environment
|
|
@@ -8827,10 +8927,9 @@ function arabicXeLatexPreambleCmd() {
|
|
|
8827
8927
|
\newcommand{\horzbar}{\rule[.5ex]{2.5ex}{0.5pt}}
|
|
8828
8928
|
|
|
8829
8929
|
|
|
8830
|
-
\newcommand{\
|
|
8831
|
-
|
|
8832
|
-
\newcommand{\
|
|
8833
|
-
\newcommand{\arabvec}[1]{\butexreflect{$\vec{\butexreflect{$#1$}}$}}
|
|
8930
|
+
\newcommand{\arsqrt}[2][]{\reflectbox{\(\sqrt[\reflectbox{\(#1\)}]{\reflectbox{\(#2\)}}\)}}
|
|
8931
|
+
\newcommand{\arabsqrt}[2][]{\arsqrt[#1]{#2}}
|
|
8932
|
+
\newcommand{\arabvec}[1]{\reflectbox{$\vec{\reflectbox{$#1$}}$}}
|
|
8834
8933
|
|
|
8835
8934
|
\newcommand{\arabexp}[1]{{}^{#1}\!\raisebox{-4.5pt}{\text{\diwani{ه}}}}
|
|
8836
8935
|
\newcommand{\arablog}[2]{\left(\text{#2}\right)\!\prescript{}{\text{#1}}{\text{\diwani{لو}}}}
|
|
@@ -8878,9 +8977,9 @@ function arabicXeLatexPreambleCmd() {
|
|
|
8878
8977
|
\newcommand{\araboddde}[2][-5pt]{\stackrel{\raisebox{#1}{$\vcenter{\hbox{$\cdot\!\cdot\!\cdot$}}$}}{\text{#2}}}
|
|
8879
8978
|
\newcommand{\arabpde}[1]{\prescript{}{#1\!\!}{\nabla}} % arabic partial differential equation (PDE)
|
|
8880
8979
|
|
|
8881
|
-
\newcommand{\arabprime}[0]{\
|
|
8882
|
-
\newcommand{\arabpprime}[0]{\
|
|
8883
|
-
\newcommand{\arabppprime}[0]{\
|
|
8980
|
+
\newcommand{\arabprime}[0]{\reflectbox{$\prime$}\!} % arabic prime notation
|
|
8981
|
+
\newcommand{\arabpprime}[0]{\reflectbox{$\prime$}\reflectbox{$\prime$}\!} % arabic prime notation
|
|
8982
|
+
\newcommand{\arabppprime}[0]{\reflectbox{$\prime$}\reflectbox{$\prime$}\reflectbox{$\prime$}\!} % arabic prime notation
|
|
8884
8983
|
|
|
8885
8984
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
8886
8985
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@@ -8900,7 +8999,6 @@ function arabicXeLatexPreambleCmd() {
|
|
|
8900
8999
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
8901
9000
|
|
|
8902
9001
|
|
|
8903
|
-
\newcommand{\arsqrt}[2][]{\butexreflect{\(\sqrt[\butexreflect{\(#1\)}]{\butexreflect{\(#2\)}}\)}}
|
|
8904
9002
|
\newcommand{\arexp}[0]{\!\raisebox{-4.5pt}{\text{\diwani{ه}}}}
|
|
8905
9003
|
\newcommand{\arlog}[0]{\!\!\text{\diwani{لو}}}
|
|
8906
9004
|
\newcommand{\arln}[0]{\!\!\prescript{}{\text{\diwani{ه}}}{\text{\diwani{لو}}}}
|
|
@@ -12090,6 +12188,22 @@ var WIDGET_CHROME_CSS = `
|
|
|
12090
12188
|
padding: 10px 12px;
|
|
12091
12189
|
}
|
|
12092
12190
|
|
|
12191
|
+
.butex-widget .butex-editor-input-bridge {
|
|
12192
|
+
border: 0;
|
|
12193
|
+
font-size: 16px;
|
|
12194
|
+
height: 1px;
|
|
12195
|
+
margin: 0;
|
|
12196
|
+
max-height: 1px;
|
|
12197
|
+
min-height: 1px;
|
|
12198
|
+
opacity: 0;
|
|
12199
|
+
overflow: hidden;
|
|
12200
|
+
padding: 0;
|
|
12201
|
+
pointer-events: none;
|
|
12202
|
+
position: absolute;
|
|
12203
|
+
resize: none;
|
|
12204
|
+
width: 1px;
|
|
12205
|
+
}
|
|
12206
|
+
|
|
12093
12207
|
.butex-widget .toolbar {
|
|
12094
12208
|
display: flex;
|
|
12095
12209
|
flex-wrap: wrap;
|
|
@@ -13091,6 +13205,7 @@ var ButexEditor = forwardRef(
|
|
|
13091
13205
|
const messages = equationEditorMessages(uiLocale);
|
|
13092
13206
|
const wrapperRef = useRef6(null);
|
|
13093
13207
|
const surfaceRef = useRef6(null);
|
|
13208
|
+
const inputRef = useRef6(null);
|
|
13094
13209
|
const mathOutputRef = useRef6(null);
|
|
13095
13210
|
const renderErrorRef = useRef6(null);
|
|
13096
13211
|
const latexLinesRef = useRef6(null);
|
|
@@ -13202,6 +13317,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
13202
13317
|
}
|
|
13203
13318
|
const runtime = createEditorRuntime({
|
|
13204
13319
|
surfaceEl,
|
|
13320
|
+
inputEl: inputRef.current,
|
|
13205
13321
|
initialSession,
|
|
13206
13322
|
defaultSide,
|
|
13207
13323
|
uiLocale,
|
|
@@ -13243,7 +13359,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
13243
13359
|
} else {
|
|
13244
13360
|
runtime.render();
|
|
13245
13361
|
}
|
|
13246
|
-
|
|
13362
|
+
runtime.focusInput();
|
|
13247
13363
|
return () => {
|
|
13248
13364
|
runtime.destroy();
|
|
13249
13365
|
runtimeRef.current = null;
|
|
@@ -13257,7 +13373,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
13257
13373
|
}
|
|
13258
13374
|
}, [uiLocale]);
|
|
13259
13375
|
function focusSurface() {
|
|
13260
|
-
|
|
13376
|
+
runtimeRef.current?.focusInput();
|
|
13261
13377
|
}
|
|
13262
13378
|
function insertSelectedEnvironment(rows, columns) {
|
|
13263
13379
|
if (envPaletteMode === "array") {
|
|
@@ -14335,6 +14451,20 @@ ${arabic || currentMessages.empty}`;
|
|
|
14335
14451
|
"aria-label": messages.equationEditor
|
|
14336
14452
|
}
|
|
14337
14453
|
),
|
|
14454
|
+
/* @__PURE__ */ jsx12(
|
|
14455
|
+
"textarea",
|
|
14456
|
+
{
|
|
14457
|
+
ref: inputRef,
|
|
14458
|
+
className: "butex-editor-input-bridge",
|
|
14459
|
+
"aria-label": messages.equationEditor,
|
|
14460
|
+
autoCapitalize: "none",
|
|
14461
|
+
autoComplete: "off",
|
|
14462
|
+
autoCorrect: "off",
|
|
14463
|
+
inputMode: "text",
|
|
14464
|
+
spellCheck: false,
|
|
14465
|
+
tabIndex: -1
|
|
14466
|
+
}
|
|
14467
|
+
),
|
|
14338
14468
|
/* @__PURE__ */ jsx12("div", { ref: renderErrorRef, className: "error", hidden: true })
|
|
14339
14469
|
] }),
|
|
14340
14470
|
/* @__PURE__ */ jsx12("section", { className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ jsx12("div", { ref: mathOutputRef, className: "preview-box" }) }),
|