mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-22 04:58:35 +01:00
web: Remove touch event for input lines
This commit is contained in:
parent
09ef5e8da3
commit
85bd77f99f
@ -53,7 +53,11 @@
|
|||||||
History,
|
History,
|
||||||
}
|
}
|
||||||
|
|
||||||
function setText(text: string, isFinalBeforeSubmit = false, isComposing = false) {
|
function setText(
|
||||||
|
text: string,
|
||||||
|
isFinalBeforeSubmit = false,
|
||||||
|
isComposing = false
|
||||||
|
) {
|
||||||
const [highlighted, offset] = highlight(
|
const [highlighted, offset] = highlight(
|
||||||
text,
|
text,
|
||||||
isFinalBeforeSubmit
|
isFinalBeforeSubmit
|
||||||
@ -62,7 +66,7 @@
|
|||||||
);
|
);
|
||||||
const prevCursorPos = inputElement.selectionStart;
|
const prevCursorPos = inputElement.selectionStart;
|
||||||
setHtml(highlighted);
|
setHtml(highlighted);
|
||||||
if(!isComposing){
|
if (!isComposing) {
|
||||||
setCaret(prevCursorPos + offset);
|
setCaret(prevCursorPos + offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +232,11 @@
|
|||||||
|
|
||||||
const event = e as InputEvent;
|
const event = e as InputEvent;
|
||||||
const target = event.target as HTMLInputElement;
|
const target = event.target as HTMLInputElement;
|
||||||
setText(target.value == "\n" ? "" : target.value, undefined, event.isComposing);
|
setText(
|
||||||
|
target.value == "\n" ? "" : target.value,
|
||||||
|
undefined,
|
||||||
|
event.isComposing
|
||||||
|
);
|
||||||
|
|
||||||
if (event.data == "(") {
|
if (event.data == "(") {
|
||||||
insertText(")");
|
insertText(")");
|
||||||
@ -236,21 +244,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleTouchLine(event: Event) {
|
|
||||||
if (!inputElement.value) {
|
|
||||||
const target = event.currentTarget as HTMLElement;
|
|
||||||
setHtml(target.innerHTML);
|
|
||||||
|
|
||||||
// Sighs... What else?
|
|
||||||
let i = 0;
|
|
||||||
setInterval(() => {
|
|
||||||
if (i == 40) return;
|
|
||||||
inputElement.focus({ preventScroll: true });
|
|
||||||
i++;
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleButtonClick(event: Event) {
|
function handleButtonClick(event: Event) {
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
target.blur();
|
target.blur();
|
||||||
@ -606,7 +599,7 @@
|
|||||||
{#if line[1]}
|
{#if line[1]}
|
||||||
<span style="color: {promptcolor}">>></span>
|
<span style="color: {promptcolor}">>></span>
|
||||||
{/if}
|
{/if}
|
||||||
<span class="value" on:touchstart={handleTouchLine}>
|
<span class="value">
|
||||||
{@html line[0]}
|
{@html line[0]}
|
||||||
</span>
|
</span>
|
||||||
</console-line>
|
</console-line>
|
||||||
|
Loading…
Reference in New Issue
Block a user