diff --git a/src/lib/WebVM.svelte b/src/lib/WebVM.svelte index 32a4ea7..ababa10 100644 --- a/src/lib/WebVM.svelte +++ b/src/lib/WebVM.svelte @@ -330,6 +330,16 @@ await blockCache.reset(); location.reload(); } + function getKmsInputElement() + { + // Find the CheerpX textare, it's attached to the body element + for(const node of document.body.children) + { + if(node.tagName == "TEXTAREA") + return node; + } + return null; + } async function handleTool(tool) { if(tool.command) @@ -417,6 +427,27 @@ display.dispatchEvent(me); return null; } + case "type": + { + var str = tool.text; + return new Promise(async function(f, r) + { + var textArea = getKmsInputElement(); + for(var i=0;i