From 7fae65962bcb8ca3d6c087de7c747af292f64bf5 Mon Sep 17 00:00:00 2001 From: Jesse Pavel Date: Fri, 31 May 2024 15:21:41 -0400 Subject: [PATCH] Automatically type untypeable characters --- js/guided-typing.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/guided-typing.mjs b/js/guided-typing.mjs index 7e91919..57b1536 100644 --- a/js/guided-typing.mjs +++ b/js/guided-typing.mjs @@ -125,7 +125,14 @@ function processTextInput(textarea, expandedText, successCheck, keyboard) { textarea.style.removeProperty("color"); successCheck.style.removeProperty("display"); const nextChar = expandedText[t.length]; - keyboard.highlightKeysForChar(nextChar); + const keys = keyboard.keysForChar(nextChar); + if (keys.length) // the keyboard can produce this character + keyboard.highlightKeys(keys); + else // type it for the user + setTimeout(() => { + textarea.value += nextChar; + processTextInput(textarea, expandedText, successCheck, keyboard); + }, 250); } } }