mirror of
https://github.com/PaddiM8/kalker.git
synced 2024-12-13 01:50:41 +01:00
web: Fixed caret position offset on button press input
This commit is contained in:
parent
df1eef8e7f
commit
adc5e14fec
@ -217,10 +217,12 @@
|
|||||||
let offset = 0;
|
let offset = 0;
|
||||||
if (input == "(") {
|
if (input == "(") {
|
||||||
input += ")";
|
input += ")";
|
||||||
|
offset = -1;
|
||||||
} else if (input == "=") {
|
} else if (input == "=") {
|
||||||
input = " = ";
|
input = " = ";
|
||||||
} else if (input == "∑") {
|
} else if (input == "∑") {
|
||||||
input += "()";
|
input += "()";
|
||||||
|
offset = -1;
|
||||||
} else if (input == "∫") {
|
} else if (input == "∫") {
|
||||||
input += "()";
|
input += "()";
|
||||||
offset = -1;
|
offset = -1;
|
||||||
@ -240,8 +242,9 @@
|
|||||||
inputElement.selectionEnd,
|
inputElement.selectionEnd,
|
||||||
"end"
|
"end"
|
||||||
);
|
);
|
||||||
inputElement.selectionEnd += offset;
|
|
||||||
setText(inputElement.value);
|
setText(inputElement.value);
|
||||||
|
inputElement.selectionStart += offset;
|
||||||
|
inputElement.selectionEnd = inputElement.selectionStart;
|
||||||
inputElement.focus({ preventScroll: true });
|
inputElement.focus({ preventScroll: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user