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;
|
||||
if (input == "(") {
|
||||
input += ")";
|
||||
offset = -1;
|
||||
} else if (input == "=") {
|
||||
input = " = ";
|
||||
} else if (input == "∑") {
|
||||
input += "()";
|
||||
offset = -1;
|
||||
} else if (input == "∫") {
|
||||
input += "()";
|
||||
offset = -1;
|
||||
@ -240,8 +242,9 @@
|
||||
inputElement.selectionEnd,
|
||||
"end"
|
||||
);
|
||||
inputElement.selectionEnd += offset;
|
||||
setText(inputElement.value);
|
||||
inputElement.selectionStart += offset;
|
||||
inputElement.selectionEnd = inputElement.selectionStart;
|
||||
inputElement.focus({ preventScroll: true });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user