From 6ec7fcb9fa232f688c943b2901d9f574f08296d4 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 20 Dec 2021 04:34:27 +0000 Subject: [PATCH] refactor(keybinds): change editor save keybind S We need to stop the event from bubbling up to the browser and opening a 'save html' window to keep support in the browser, other than that, straight forward change to swap keybinding to 'S' for saving in the editor. Resolves danielyxie/bitburner#2053 --- src/ScriptEditor/ui/ScriptEditorRoot.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index 1fc73aaa1..021e74eaa 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -277,9 +277,11 @@ export function Root(props: IProps): React.ReactElement { useEffect(() => { function maybeSave(event: KeyboardEvent): void { if (Settings.DisableHotkeys) return; - //Ctrl + b - if (event.keyCode == 66 && (event.ctrlKey || event.metaKey)) { + + // CTRL/CMD + S + if (event.code == `KeyS` && (event.ctrlKey || event.metaKey)) { event.preventDefault(); + event.stopPropagation(); save(); } } @@ -622,7 +624,7 @@ export function Root(props: IProps): React.ReactElement { {ram} - + {" "} Documentation:{" "}