mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-02-28 22:31:15 +01:00
web: Fixed double closed parenthesis on phone
This commit is contained in:
parent
909b009d5e
commit
0cdecd35b7
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@paddim8/kalk-component",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"description": "A Svelte component for kalk, a calculator that supports user-defined functions and variables.",
|
||||
"svelte": "src/main.ts",
|
||||
"main": "public/build/bundle.js",
|
||||
|
@ -46,6 +46,7 @@
|
||||
let inputElement: HTMLTextAreaElement;
|
||||
let highlightedTextElement: HTMLElement;
|
||||
let hasBeenInteractedWith = false;
|
||||
let ignoreNextInput = false;
|
||||
|
||||
function setText(text: string) {
|
||||
const [highlighted, offset] = highlight(text);
|
||||
@ -188,6 +189,11 @@
|
||||
}
|
||||
|
||||
function handleInput(e: Event) {
|
||||
if (ignoreNextInput) {
|
||||
ignoreNextInput = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const event = e as InputEvent;
|
||||
const target = event.target as HTMLInputElement;
|
||||
setText(target.value == "\n" ? "" : target.value);
|
||||
@ -249,6 +255,7 @@
|
||||
input = ", ";
|
||||
}
|
||||
|
||||
ignoreNextInput = true;
|
||||
inputElement.setRangeText(
|
||||
input,
|
||||
inputElement.selectionStart,
|
||||
@ -256,6 +263,7 @@
|
||||
"end"
|
||||
);
|
||||
setText(inputElement.value);
|
||||
ignoreNextInput = false;
|
||||
offsetCaret(offset);
|
||||
inputElement.focus({ preventScroll: true });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user