mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Mobile webclient: Fix pressing 'Go' button on on-screen keyboard on android chrome repeatedly not actually sending chat until you had clicked one of the text prediction suggestions
This commit is contained in:
parent
b8b29dfb07
commit
629b44b038
@ -318,13 +318,15 @@ void interop_OpenKeyboard(const char* text, int type, const char* placeholder) {
|
||||
}, text, type, placeholder);
|
||||
}
|
||||
|
||||
/* NOTE: When pressing 'Go' on the on-screen keyboard, web browser adds \n to value */
|
||||
void interop_SetKeyboardText(const char* text) {
|
||||
EM_ASM_({
|
||||
if (!window.cc_inputElem) return;
|
||||
var str = UTF8ToString($0);
|
||||
var cur = window.cc_inputElem.value;
|
||||
|
||||
if (str == window.cc_inputElem.value) return;
|
||||
window.cc_inputElem.value = str;
|
||||
if (cur.length && cur[cur.length - 1] == '\n') { cur = cur.substring(0, cur.length - 1); }
|
||||
if (str != cur) window.cc_inputElem.value = str;
|
||||
}, text);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user