mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-06-28 05:32:00 +02:00
Quick fix for the caret composition issue
This commit is contained in:
parent
f31fb43758
commit
5282ed531e
@ -53,7 +53,7 @@
|
|||||||
History,
|
History,
|
||||||
}
|
}
|
||||||
|
|
||||||
function setText(text: string, isFinalBeforeSubmit = false) {
|
function setText(text: string, isFinalBeforeSubmit = false, isComposing = false) {
|
||||||
const [highlighted, offset] = highlight(
|
const [highlighted, offset] = highlight(
|
||||||
text,
|
text,
|
||||||
isFinalBeforeSubmit
|
isFinalBeforeSubmit
|
||||||
@ -62,7 +62,9 @@
|
|||||||
);
|
);
|
||||||
const prevCursorPos = inputElement.selectionStart;
|
const prevCursorPos = inputElement.selectionStart;
|
||||||
setHtml(highlighted);
|
setHtml(highlighted);
|
||||||
setCaret(prevCursorPos + offset);
|
if(!isComposing){
|
||||||
|
setCaret(prevCursorPos + offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHtml(html: string) {
|
function setHtml(html: string) {
|
||||||
@ -226,7 +228,7 @@
|
|||||||
|
|
||||||
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);
|
setText(target.value == "\n" ? "" : target.value, undefined, event.isComposing);
|
||||||
|
|
||||||
if (event.data == "(") {
|
if (event.data == "(") {
|
||||||
insertText(")");
|
insertText(")");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user