From 5ef041a5db2c552b3caf8fd3b2fdf206f6fcac61 Mon Sep 17 00:00:00 2001 From: nanogyth Date: Sun, 27 Mar 2022 08:47:47 -0400 Subject: [PATCH] [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' --- doc/source/netscript/advancedfunctions/inject_html.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/netscript/advancedfunctions/inject_html.rst b/doc/source/netscript/advancedfunctions/inject_html.rst index bec8bde50..a098e8be6 100644 --- a/doc/source/netscript/advancedfunctions/inject_html.rst +++ b/doc/source/netscript/advancedfunctions/inject_html.rst @@ -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',`
  • whatever custom html

  • `) \ No newline at end of file + list.insertAdjacentHTML('beforeend',`
  • whatever custom html

  • `)