[Doc] Update Injecting HTML guide

keyCode is deprecated, method in doc doesn't work
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode

Updating with "modern" method
key:'Enter'
This commit is contained in:
nanogyth 2022-03-27 08:47:47 -04:00 committed by GitHub
parent 4cba813fe4
commit 5ef041a5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,7 +21,7 @@ To automatically enter commands in the terminal (only works if looking at the te
terminalInput[handler].onChange({target:terminalInput});
// Simulate an enter press
terminalInput[handler].onKeyDown({keyCode:13,preventDefault:()=>null});
terminalInput[handler].onKeyDown({key:'Enter',preventDefault:()=>null});
To add lines to the terminal (only works if looking at the terminal):
@ -32,4 +32,4 @@ To add lines to the terminal (only works if looking at the terminal):
const list = document.getElementById("generic-react-container").querySelector("ul");
// Inject some HTML.
list.insertAdjacentHTML('beforeend',`<li><p color=lime>whatever custom html</p></li>`)
list.insertAdjacentHTML('beforeend',`<li><p color=lime>whatever custom html</p></li>`)