@drghaliasri/butex 5.5.0 → 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 +1 -0
- 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.js +9 -10
- package/dist/document2.js.map +1 -1
- package/dist/document2.mjs +9 -10
- 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.js +178 -48
- package/dist/react-document2.js.map +1 -1
- package/dist/react-document2.mjs +178 -48
- 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-document2.js
CHANGED
|
@@ -6435,7 +6435,8 @@ ${BUTEX_FONT_FACE_CSS}
|
|
|
6435
6435
|
transition: box-shadow 0.15s ease, border-color 0.15s ease;
|
|
6436
6436
|
}
|
|
6437
6437
|
|
|
6438
|
-
.surface:focus
|
|
6438
|
+
.surface:focus,
|
|
6439
|
+
.surface.surface--typing-focus {
|
|
6439
6440
|
border-color: var(--butex-focus-border, rgba(13, 148, 136, 0.45));
|
|
6440
6441
|
box-shadow: 0 0 0 3px var(--butex-focus-shadow, rgba(13, 148, 136, 0.12));
|
|
6441
6442
|
}
|
|
@@ -6637,7 +6638,7 @@ function injectBuTeXEditorStyles(doc) {
|
|
|
6637
6638
|
|
|
6638
6639
|
// src/editor/runtime.ts
|
|
6639
6640
|
function createEditorRuntime(options) {
|
|
6640
|
-
const { surfaceEl } = options;
|
|
6641
|
+
const { surfaceEl, inputEl } = options;
|
|
6641
6642
|
const buttonElements = options.buttonElements ?? {};
|
|
6642
6643
|
const outsidePointerIgnoreSelectors = options.outsidePointerIgnoreSelectors ?? [];
|
|
6643
6644
|
let session = options.initialSession ?? createStarterSession();
|
|
@@ -6651,6 +6652,23 @@ function createEditorRuntime(options) {
|
|
|
6651
6652
|
let dragSelecting = false;
|
|
6652
6653
|
let dragChainId = null;
|
|
6653
6654
|
let dragChanged = false;
|
|
6655
|
+
let composingInput = false;
|
|
6656
|
+
let pendingCompositionText = null;
|
|
6657
|
+
function resetInputElement() {
|
|
6658
|
+
if (!inputEl) {
|
|
6659
|
+
return;
|
|
6660
|
+
}
|
|
6661
|
+
inputEl.value = "";
|
|
6662
|
+
}
|
|
6663
|
+
function focusInput() {
|
|
6664
|
+
if (!inputEl) {
|
|
6665
|
+
surfaceEl.focus();
|
|
6666
|
+
return;
|
|
6667
|
+
}
|
|
6668
|
+
inputEl.focus({ preventScroll: true });
|
|
6669
|
+
const end = inputEl.value.length;
|
|
6670
|
+
inputEl.setSelectionRange(end, end);
|
|
6671
|
+
}
|
|
6654
6672
|
function notifySessionChange() {
|
|
6655
6673
|
options.onSessionChange?.(session);
|
|
6656
6674
|
}
|
|
@@ -6915,7 +6933,7 @@ function createEditorRuntime(options) {
|
|
|
6915
6933
|
event.preventDefault();
|
|
6916
6934
|
event.stopPropagation();
|
|
6917
6935
|
startDragSelection(chainId, index);
|
|
6918
|
-
|
|
6936
|
+
focusInput();
|
|
6919
6937
|
});
|
|
6920
6938
|
slot.addEventListener("click", (event) => {
|
|
6921
6939
|
if (dragChanged) {
|
|
@@ -6925,7 +6943,7 @@ function createEditorRuntime(options) {
|
|
|
6925
6943
|
return;
|
|
6926
6944
|
}
|
|
6927
6945
|
applyTransient((prev) => setCaret(prev, chainId, index));
|
|
6928
|
-
|
|
6946
|
+
focusInput();
|
|
6929
6947
|
});
|
|
6930
6948
|
if (session.caret.chainId === chainId && session.caret.index === index) {
|
|
6931
6949
|
const caret = document.createElement("span");
|
|
@@ -6957,7 +6975,7 @@ function createEditorRuntime(options) {
|
|
|
6957
6975
|
event.preventDefault();
|
|
6958
6976
|
event.stopPropagation();
|
|
6959
6977
|
startDragSelection(chainId, indexInChain);
|
|
6960
|
-
|
|
6978
|
+
focusInput();
|
|
6961
6979
|
});
|
|
6962
6980
|
nodeEl.addEventListener("click", (event) => {
|
|
6963
6981
|
if (dragChanged) {
|
|
@@ -6968,7 +6986,7 @@ function createEditorRuntime(options) {
|
|
|
6968
6986
|
}
|
|
6969
6987
|
event.stopPropagation();
|
|
6970
6988
|
applyTransient((prev) => selectNode(prev, node.id));
|
|
6971
|
-
|
|
6989
|
+
focusInput();
|
|
6972
6990
|
});
|
|
6973
6991
|
const body = document.createElement("span");
|
|
6974
6992
|
body.className = "node-body";
|
|
@@ -7003,7 +7021,7 @@ function createEditorRuntime(options) {
|
|
|
7003
7021
|
const activeTree = session[activeTreeKey(session.activeSide)];
|
|
7004
7022
|
surfaceEl.appendChild(buildChain(activeTree));
|
|
7005
7023
|
if (initialKeyboardFocusPending) {
|
|
7006
|
-
requestAnimationFrame(
|
|
7024
|
+
requestAnimationFrame(focusInput);
|
|
7007
7025
|
initialKeyboardFocusPending = false;
|
|
7008
7026
|
}
|
|
7009
7027
|
notifySessionChange();
|
|
@@ -7041,7 +7059,7 @@ function createEditorRuntime(options) {
|
|
|
7041
7059
|
}
|
|
7042
7060
|
session = restored;
|
|
7043
7061
|
render();
|
|
7044
|
-
|
|
7062
|
+
focusInput();
|
|
7045
7063
|
}
|
|
7046
7064
|
function performRedo() {
|
|
7047
7065
|
const restored = restoreRedo(undoRedo, session);
|
|
@@ -7050,9 +7068,12 @@ function createEditorRuntime(options) {
|
|
|
7050
7068
|
}
|
|
7051
7069
|
session = restored;
|
|
7052
7070
|
render();
|
|
7053
|
-
|
|
7071
|
+
focusInput();
|
|
7054
7072
|
}
|
|
7055
7073
|
function onKeyDown(event) {
|
|
7074
|
+
if (event.isComposing || event.key === "Process" || event.keyCode === 229) {
|
|
7075
|
+
return;
|
|
7076
|
+
}
|
|
7056
7077
|
const shortcutMod = event.ctrlKey || event.metaKey;
|
|
7057
7078
|
const keyLower = typeof event.key === "string" ? event.key.toLowerCase() : "";
|
|
7058
7079
|
if (shortcutMod && !event.altKey && keyLower === "z") {
|
|
@@ -7151,6 +7172,70 @@ function createEditorRuntime(options) {
|
|
|
7151
7172
|
applyStructural((prev) => insertChar(prev, char));
|
|
7152
7173
|
}
|
|
7153
7174
|
}
|
|
7175
|
+
function onBeforeInput(event) {
|
|
7176
|
+
if (composingInput || event.isComposing) {
|
|
7177
|
+
return;
|
|
7178
|
+
}
|
|
7179
|
+
if (event.inputType === "deleteContentBackward") {
|
|
7180
|
+
event.preventDefault();
|
|
7181
|
+
applyStructural((prev) => deleteBackward(prev));
|
|
7182
|
+
resetInputElement();
|
|
7183
|
+
return;
|
|
7184
|
+
}
|
|
7185
|
+
if (event.inputType === "deleteContentForward") {
|
|
7186
|
+
event.preventDefault();
|
|
7187
|
+
applyStructural((prev) => deleteForward(prev));
|
|
7188
|
+
resetInputElement();
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
function onInput(event) {
|
|
7192
|
+
if (!inputEl || composingInput) {
|
|
7193
|
+
return;
|
|
7194
|
+
}
|
|
7195
|
+
const inputEvent = event;
|
|
7196
|
+
const text = inputEvent.data ?? inputEl.value;
|
|
7197
|
+
resetInputElement();
|
|
7198
|
+
if (pendingCompositionText !== null && (inputEvent.inputType === "insertFromComposition" || text === pendingCompositionText)) {
|
|
7199
|
+
pendingCompositionText = null;
|
|
7200
|
+
return;
|
|
7201
|
+
}
|
|
7202
|
+
pendingCompositionText = null;
|
|
7203
|
+
if (inputEvent.inputType === "deleteContentBackward") {
|
|
7204
|
+
applyStructural((prev) => deleteBackward(prev));
|
|
7205
|
+
return;
|
|
7206
|
+
}
|
|
7207
|
+
if (inputEvent.inputType === "deleteContentForward") {
|
|
7208
|
+
applyStructural((prev) => deleteForward(prev));
|
|
7209
|
+
return;
|
|
7210
|
+
}
|
|
7211
|
+
if (text) {
|
|
7212
|
+
applyStructural((prev) => pasteText(prev, text));
|
|
7213
|
+
}
|
|
7214
|
+
}
|
|
7215
|
+
function onCompositionStart() {
|
|
7216
|
+
composingInput = true;
|
|
7217
|
+
}
|
|
7218
|
+
function onCompositionEnd(event) {
|
|
7219
|
+
if (!inputEl) {
|
|
7220
|
+
return;
|
|
7221
|
+
}
|
|
7222
|
+
composingInput = false;
|
|
7223
|
+
const text = event.data || inputEl.value;
|
|
7224
|
+
resetInputElement();
|
|
7225
|
+
if (text) {
|
|
7226
|
+
applyStructural((prev) => pasteText(prev, text));
|
|
7227
|
+
}
|
|
7228
|
+
pendingCompositionText = text || null;
|
|
7229
|
+
window.setTimeout(() => {
|
|
7230
|
+
pendingCompositionText = null;
|
|
7231
|
+
}, 0);
|
|
7232
|
+
}
|
|
7233
|
+
function onInputFocus() {
|
|
7234
|
+
surfaceEl.classList.add("surface--typing-focus");
|
|
7235
|
+
}
|
|
7236
|
+
function onInputBlur() {
|
|
7237
|
+
surfaceEl.classList.remove("surface--typing-focus");
|
|
7238
|
+
}
|
|
7154
7239
|
function isShortcutOnlyEvent(event) {
|
|
7155
7240
|
if (!(event.ctrlKey || event.metaKey) || event.altKey) {
|
|
7156
7241
|
return false;
|
|
@@ -7200,7 +7285,7 @@ function createEditorRuntime(options) {
|
|
|
7200
7285
|
}
|
|
7201
7286
|
event.preventDefault();
|
|
7202
7287
|
startDragSelection(resolved.chainId, resolved.slotIndex);
|
|
7203
|
-
|
|
7288
|
+
focusInput();
|
|
7204
7289
|
}
|
|
7205
7290
|
function onSurfaceClick(event) {
|
|
7206
7291
|
if (dragChanged) {
|
|
@@ -7217,7 +7302,7 @@ function createEditorRuntime(options) {
|
|
|
7217
7302
|
} else {
|
|
7218
7303
|
clearSelectionAndNodeHighlights();
|
|
7219
7304
|
}
|
|
7220
|
-
|
|
7305
|
+
focusInput();
|
|
7221
7306
|
}
|
|
7222
7307
|
function onDocumentPointerDown(event) {
|
|
7223
7308
|
const target = event.target;
|
|
@@ -7233,6 +7318,13 @@ function createEditorRuntime(options) {
|
|
|
7233
7318
|
clearSelectionAndNodeHighlights();
|
|
7234
7319
|
}
|
|
7235
7320
|
surfaceEl.addEventListener("keydown", onKeyDown);
|
|
7321
|
+
inputEl?.addEventListener("keydown", onKeyDown);
|
|
7322
|
+
inputEl?.addEventListener("beforeinput", onBeforeInput);
|
|
7323
|
+
inputEl?.addEventListener("input", onInput);
|
|
7324
|
+
inputEl?.addEventListener("compositionstart", onCompositionStart);
|
|
7325
|
+
inputEl?.addEventListener("compositionend", onCompositionEnd);
|
|
7326
|
+
inputEl?.addEventListener("focus", onInputFocus);
|
|
7327
|
+
inputEl?.addEventListener("blur", onInputBlur);
|
|
7236
7328
|
document.addEventListener("keydown", onDocumentKeyDown);
|
|
7237
7329
|
document.addEventListener("mouseup", endDragSelection);
|
|
7238
7330
|
document.addEventListener("mouseleave", endDragSelection);
|
|
@@ -7244,6 +7336,13 @@ function createEditorRuntime(options) {
|
|
|
7244
7336
|
render,
|
|
7245
7337
|
destroy: () => {
|
|
7246
7338
|
surfaceEl.removeEventListener("keydown", onKeyDown);
|
|
7339
|
+
inputEl?.removeEventListener("keydown", onKeyDown);
|
|
7340
|
+
inputEl?.removeEventListener("beforeinput", onBeforeInput);
|
|
7341
|
+
inputEl?.removeEventListener("input", onInput);
|
|
7342
|
+
inputEl?.removeEventListener("compositionstart", onCompositionStart);
|
|
7343
|
+
inputEl?.removeEventListener("compositionend", onCompositionEnd);
|
|
7344
|
+
inputEl?.removeEventListener("focus", onInputFocus);
|
|
7345
|
+
inputEl?.removeEventListener("blur", onInputBlur);
|
|
7247
7346
|
document.removeEventListener("keydown", onDocumentKeyDown);
|
|
7248
7347
|
document.removeEventListener("mouseup", endDragSelection);
|
|
7249
7348
|
document.removeEventListener("mouseleave", endDragSelection);
|
|
@@ -7264,6 +7363,7 @@ function createEditorRuntime(options) {
|
|
|
7264
7363
|
uiLocale = locale;
|
|
7265
7364
|
render();
|
|
7266
7365
|
},
|
|
7366
|
+
focusInput,
|
|
7267
7367
|
performUndo,
|
|
7268
7368
|
performRedo,
|
|
7269
7369
|
performCopy,
|
|
@@ -7271,27 +7371,27 @@ function createEditorRuntime(options) {
|
|
|
7271
7371
|
performPaste,
|
|
7272
7372
|
toggleSide: () => {
|
|
7273
7373
|
applyTransient((prev) => switchSide(prev));
|
|
7274
|
-
|
|
7374
|
+
focusInput();
|
|
7275
7375
|
},
|
|
7276
7376
|
toggleSplitLeafTyping: () => {
|
|
7277
7377
|
applyStructural((prev) => setSplitLeafTyping(prev, !prev.splitLeafTyping));
|
|
7278
|
-
|
|
7378
|
+
focusInput();
|
|
7279
7379
|
},
|
|
7280
7380
|
toggleArabicReverseNumberTyping: () => {
|
|
7281
7381
|
applyStructural((prev) => setArabicReverseNumberTyping(prev, !prev.arabicReverseNumberTyping));
|
|
7282
|
-
|
|
7382
|
+
focusInput();
|
|
7283
7383
|
},
|
|
7284
7384
|
toggleTakweenCharacterFont: () => {
|
|
7285
7385
|
applyTransient((prev) => toggleTakweenCharacterFont(prev));
|
|
7286
|
-
|
|
7386
|
+
focusInput();
|
|
7287
7387
|
},
|
|
7288
7388
|
setCurrentCharacterFont: (fontId) => {
|
|
7289
7389
|
applyTransient((prev) => setCurrentCharacterFont(prev, fontId));
|
|
7290
|
-
|
|
7390
|
+
focusInput();
|
|
7291
7391
|
},
|
|
7292
7392
|
setCurrentDigitForm: (digitForm) => {
|
|
7293
7393
|
applyStructural((prev) => setCurrentDigitForm(prev, digitForm));
|
|
7294
|
-
|
|
7394
|
+
focusInput();
|
|
7295
7395
|
},
|
|
7296
7396
|
insertDelimiterByKind: (kind) => {
|
|
7297
7397
|
if (kind === "paren") {
|
|
@@ -7301,79 +7401,79 @@ function createEditorRuntime(options) {
|
|
|
7301
7401
|
} else {
|
|
7302
7402
|
applyStructural((prev) => insertDelimiterPair(prev, "\\left\\{", "\\right\\}"));
|
|
7303
7403
|
}
|
|
7304
|
-
|
|
7404
|
+
focusInput();
|
|
7305
7405
|
},
|
|
7306
7406
|
insertFraction: () => {
|
|
7307
7407
|
applyStructural((prev) => insertFraction(prev));
|
|
7308
|
-
|
|
7408
|
+
focusInput();
|
|
7309
7409
|
},
|
|
7310
7410
|
insertFirstDerivative: () => {
|
|
7311
7411
|
applyStructural((prev) => insertFirstDerivative(prev));
|
|
7312
|
-
|
|
7412
|
+
focusInput();
|
|
7313
7413
|
},
|
|
7314
7414
|
insertSecondDerivative: () => {
|
|
7315
7415
|
applyStructural((prev) => insertSecondDerivative(prev));
|
|
7316
|
-
|
|
7416
|
+
focusInput();
|
|
7317
7417
|
},
|
|
7318
7418
|
insertMatrixEnv: (style, rows, columns) => {
|
|
7319
7419
|
applyStructural((prev) => insertMatrixEnv(prev, style, rows, columns));
|
|
7320
|
-
|
|
7420
|
+
focusInput();
|
|
7321
7421
|
},
|
|
7322
7422
|
insertArrayEnv: (rows, columns) => {
|
|
7323
7423
|
applyStructural((prev) => insertArrayEnv(prev, rows, columns));
|
|
7324
|
-
|
|
7424
|
+
focusInput();
|
|
7325
7425
|
},
|
|
7326
7426
|
insertAlignedEnv: (rows, columns) => {
|
|
7327
7427
|
applyStructural((prev) => insertAlignedEnv(prev, rows, columns));
|
|
7328
|
-
|
|
7428
|
+
focusInput();
|
|
7329
7429
|
},
|
|
7330
7430
|
insertSqrt: () => {
|
|
7331
7431
|
applyStructural((prev) => insertSqrt(prev));
|
|
7332
|
-
|
|
7432
|
+
focusInput();
|
|
7333
7433
|
},
|
|
7334
7434
|
insertOverset: () => {
|
|
7335
7435
|
applyStructural((prev) => insertOverset(prev));
|
|
7336
|
-
|
|
7436
|
+
focusInput();
|
|
7337
7437
|
},
|
|
7338
7438
|
insertUnderset: () => {
|
|
7339
7439
|
applyStructural((prev) => insertUnderset(prev));
|
|
7340
|
-
|
|
7440
|
+
focusInput();
|
|
7341
7441
|
},
|
|
7342
7442
|
insertLimitsSeriesTemplate: (commandId) => {
|
|
7343
7443
|
applyStructural((prev) => insertLimitsSeriesTemplate(prev, commandId));
|
|
7344
|
-
|
|
7444
|
+
focusInput();
|
|
7345
7445
|
},
|
|
7346
7446
|
insertAccentPair: () => {
|
|
7347
7447
|
applyStructural((prev) => insertAccentPair(prev));
|
|
7348
|
-
|
|
7448
|
+
focusInput();
|
|
7349
7449
|
},
|
|
7350
7450
|
insertAccent: (accentId) => {
|
|
7351
7451
|
applyStructural((prev) => insertAccent(prev, accentId));
|
|
7352
|
-
|
|
7452
|
+
focusInput();
|
|
7353
7453
|
},
|
|
7354
7454
|
insertAtomicCommand: (commandId) => {
|
|
7355
7455
|
applyStructural((prev) => insertAtomicCommand(prev, commandId));
|
|
7356
|
-
|
|
7456
|
+
focusInput();
|
|
7357
7457
|
},
|
|
7358
7458
|
insertAtomicOperatorCommand: (commandId) => {
|
|
7359
7459
|
applyStructural((prev) => insertAtomicOperatorCommand(prev, commandId));
|
|
7360
|
-
|
|
7460
|
+
focusInput();
|
|
7361
7461
|
},
|
|
7362
7462
|
addSup: () => {
|
|
7363
7463
|
applyStructural((prev) => addSup(prev));
|
|
7364
|
-
|
|
7464
|
+
focusInput();
|
|
7365
7465
|
},
|
|
7366
7466
|
addSub: () => {
|
|
7367
7467
|
applyStructural((prev) => addSub(prev));
|
|
7368
|
-
|
|
7468
|
+
focusInput();
|
|
7369
7469
|
},
|
|
7370
7470
|
removeSup: () => {
|
|
7371
7471
|
applyStructural((prev) => removeSup(prev));
|
|
7372
|
-
|
|
7472
|
+
focusInput();
|
|
7373
7473
|
},
|
|
7374
7474
|
removeSub: () => {
|
|
7375
7475
|
applyStructural((prev) => removeSub(prev));
|
|
7376
|
-
|
|
7476
|
+
focusInput();
|
|
7377
7477
|
},
|
|
7378
7478
|
setMatrixEnvStyle: (style) => {
|
|
7379
7479
|
applyStructural((prev) => setMatrixEnvStyle(prev, style));
|
|
@@ -7395,7 +7495,7 @@ function createEditorRuntime(options) {
|
|
|
7395
7495
|
},
|
|
7396
7496
|
deleteStructure: () => {
|
|
7397
7497
|
applyStructural((prev) => deleteStructure(prev));
|
|
7398
|
-
|
|
7498
|
+
focusInput();
|
|
7399
7499
|
}
|
|
7400
7500
|
};
|
|
7401
7501
|
render();
|
|
@@ -8793,7 +8893,7 @@ function arabicXeLatexPreamblePkg(twocolumn = false) {
|
|
|
8793
8893
|
\usepackage{bidi}
|
|
8794
8894
|
\usepackage{multirow}
|
|
8795
8895
|
\usepackage{booktabs}
|
|
8796
|
-
\usepackage{graphicx} % For \
|
|
8896
|
+
\usepackage{graphicx} % For \reflectbox
|
|
8797
8897
|
\usepackage{xcolor}
|
|
8798
8898
|
\usepackage{tikz}
|
|
8799
8899
|
\usepackage{tcolorbox} % For tcolorbox environment
|
|
@@ -8862,10 +8962,8 @@ function arabicXeLatexPreambleCmd() {
|
|
|
8862
8962
|
\newcommand{\horzbar}{\rule[.5ex]{2.5ex}{0.5pt}}
|
|
8863
8963
|
|
|
8864
8964
|
|
|
8865
|
-
\newcommand{\
|
|
8866
|
-
|
|
8867
|
-
\newcommand{\arabsqrt}[2]{\butexreflect{\(\sqrt[\butexreflect{\(#1\)}]{\butexreflect{\(#2\)}}\)}}
|
|
8868
|
-
\newcommand{\arabvec}[1]{\butexreflect{$\vec{\butexreflect{$#1$}}$}}
|
|
8965
|
+
\newcommand{\arabsqrt}[2]{\reflectbox{\(\sqrt[\reflectbox{\(#1\)}]{\reflectbox{\(#2\)}}\)}}
|
|
8966
|
+
\newcommand{\arabvec}[1]{\reflectbox{$\vec{\reflectbox{$#1$}}$}}
|
|
8869
8967
|
|
|
8870
8968
|
\newcommand{\arabexp}[1]{{}^{#1}\!\raisebox{-4.5pt}{\text{\diwani{ه}}}}
|
|
8871
8969
|
\newcommand{\arablog}[2]{\left(\text{#2}\right)\!\prescript{}{\text{#1}}{\text{\diwani{لو}}}}
|
|
@@ -8913,9 +9011,9 @@ function arabicXeLatexPreambleCmd() {
|
|
|
8913
9011
|
\newcommand{\araboddde}[2][-5pt]{\stackrel{\raisebox{#1}{$\vcenter{\hbox{$\cdot\!\cdot\!\cdot$}}$}}{\text{#2}}}
|
|
8914
9012
|
\newcommand{\arabpde}[1]{\prescript{}{#1\!\!}{\nabla}} % arabic partial differential equation (PDE)
|
|
8915
9013
|
|
|
8916
|
-
\newcommand{\arabprime}[0]{\
|
|
8917
|
-
\newcommand{\arabpprime}[0]{\
|
|
8918
|
-
\newcommand{\arabppprime}[0]{\
|
|
9014
|
+
\newcommand{\arabprime}[0]{\reflectbox{$\prime$}\!} % arabic prime notation
|
|
9015
|
+
\newcommand{\arabpprime}[0]{\reflectbox{$\prime$}\reflectbox{$\prime$}\!} % arabic prime notation
|
|
9016
|
+
\newcommand{\arabppprime}[0]{\reflectbox{$\prime$}\reflectbox{$\prime$}\reflectbox{$\prime$}\!} % arabic prime notation
|
|
8919
9017
|
|
|
8920
9018
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
8921
9019
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@@ -8935,7 +9033,7 @@ function arabicXeLatexPreambleCmd() {
|
|
|
8935
9033
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
8936
9034
|
|
|
8937
9035
|
|
|
8938
|
-
\newcommand{\arsqrt}[2][]{\
|
|
9036
|
+
\newcommand{\arsqrt}[2][]{\reflectbox{\(\sqrt[\reflectbox{\(#1\)}]{\reflectbox{\(#2\)}}\)}}
|
|
8939
9037
|
\newcommand{\arexp}[0]{\!\raisebox{-4.5pt}{\text{\diwani{ه}}}}
|
|
8940
9038
|
\newcommand{\arlog}[0]{\!\!\text{\diwani{لو}}}
|
|
8941
9039
|
\newcommand{\arln}[0]{\!\!\prescript{}{\text{\diwani{ه}}}{\text{\diwani{لو}}}}
|
|
@@ -12118,6 +12216,22 @@ var WIDGET_CHROME_CSS = `
|
|
|
12118
12216
|
padding: 10px 12px;
|
|
12119
12217
|
}
|
|
12120
12218
|
|
|
12219
|
+
.butex-widget .butex-editor-input-bridge {
|
|
12220
|
+
border: 0;
|
|
12221
|
+
font-size: 16px;
|
|
12222
|
+
height: 1px;
|
|
12223
|
+
margin: 0;
|
|
12224
|
+
max-height: 1px;
|
|
12225
|
+
min-height: 1px;
|
|
12226
|
+
opacity: 0;
|
|
12227
|
+
overflow: hidden;
|
|
12228
|
+
padding: 0;
|
|
12229
|
+
pointer-events: none;
|
|
12230
|
+
position: absolute;
|
|
12231
|
+
resize: none;
|
|
12232
|
+
width: 1px;
|
|
12233
|
+
}
|
|
12234
|
+
|
|
12121
12235
|
.butex-widget .toolbar {
|
|
12122
12236
|
display: flex;
|
|
12123
12237
|
flex-wrap: wrap;
|
|
@@ -13119,6 +13233,7 @@ var ButexEditor = (0, import_react8.forwardRef)(
|
|
|
13119
13233
|
const messages = equationEditorMessages(uiLocale);
|
|
13120
13234
|
const wrapperRef = (0, import_react8.useRef)(null);
|
|
13121
13235
|
const surfaceRef = (0, import_react8.useRef)(null);
|
|
13236
|
+
const inputRef = (0, import_react8.useRef)(null);
|
|
13122
13237
|
const mathOutputRef = (0, import_react8.useRef)(null);
|
|
13123
13238
|
const renderErrorRef = (0, import_react8.useRef)(null);
|
|
13124
13239
|
const latexLinesRef = (0, import_react8.useRef)(null);
|
|
@@ -13230,6 +13345,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
13230
13345
|
}
|
|
13231
13346
|
const runtime = createEditorRuntime({
|
|
13232
13347
|
surfaceEl,
|
|
13348
|
+
inputEl: inputRef.current,
|
|
13233
13349
|
initialSession,
|
|
13234
13350
|
defaultSide,
|
|
13235
13351
|
uiLocale,
|
|
@@ -13271,7 +13387,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
13271
13387
|
} else {
|
|
13272
13388
|
runtime.render();
|
|
13273
13389
|
}
|
|
13274
|
-
|
|
13390
|
+
runtime.focusInput();
|
|
13275
13391
|
return () => {
|
|
13276
13392
|
runtime.destroy();
|
|
13277
13393
|
runtimeRef.current = null;
|
|
@@ -13285,7 +13401,7 @@ ${arabic || currentMessages.empty}`;
|
|
|
13285
13401
|
}
|
|
13286
13402
|
}, [uiLocale]);
|
|
13287
13403
|
function focusSurface() {
|
|
13288
|
-
|
|
13404
|
+
runtimeRef.current?.focusInput();
|
|
13289
13405
|
}
|
|
13290
13406
|
function insertSelectedEnvironment(rows, columns) {
|
|
13291
13407
|
if (envPaletteMode === "array") {
|
|
@@ -14363,6 +14479,20 @@ ${arabic || currentMessages.empty}`;
|
|
|
14363
14479
|
"aria-label": messages.equationEditor
|
|
14364
14480
|
}
|
|
14365
14481
|
),
|
|
14482
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
14483
|
+
"textarea",
|
|
14484
|
+
{
|
|
14485
|
+
ref: inputRef,
|
|
14486
|
+
className: "butex-editor-input-bridge",
|
|
14487
|
+
"aria-label": messages.equationEditor,
|
|
14488
|
+
autoCapitalize: "none",
|
|
14489
|
+
autoComplete: "off",
|
|
14490
|
+
autoCorrect: "off",
|
|
14491
|
+
inputMode: "text",
|
|
14492
|
+
spellCheck: false,
|
|
14493
|
+
tabIndex: -1
|
|
14494
|
+
}
|
|
14495
|
+
),
|
|
14366
14496
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: renderErrorRef, className: "error", hidden: true })
|
|
14367
14497
|
] }),
|
|
14368
14498
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("section", { className: "panel panel-preview", "aria-label": messages.renderPreview, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: mathOutputRef, className: "preview-box" }) }),
|