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
This commit is contained in:
Dan 2021-12-20 04:34:27 +00:00
parent 82f6bbee13
commit 6ec7fcb9fa
No known key found for this signature in database
GPG Key ID: CD0F515DA7B576B5

@ -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 {
<Typography color={updatingRam ? "secondary" : "primary"} sx={{ mx: 1 }}>
{ram}
</Typography>
<Button onClick={save}>Save (Ctrl/Cmd + b)</Button>
<Button onClick={save}>Save (CTRL/CMD + S)</Button>
<Typography sx={{ mx: 1 }}>
{" "}
Documentation:{" "}