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 
This commit is contained in:
Dan
2021-12-20 04:34:27 +00:00
parent 82f6bbee13
commit 6ec7fcb9fa

@ -277,9 +277,11 @@ export function Root(props: IProps): React.ReactElement {
useEffect(() => { useEffect(() => {
function maybeSave(event: KeyboardEvent): void { function maybeSave(event: KeyboardEvent): void {
if (Settings.DisableHotkeys) return; 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.preventDefault();
event.stopPropagation();
save(); save();
} }
} }
@ -622,7 +624,7 @@ export function Root(props: IProps): React.ReactElement {
<Typography color={updatingRam ? "secondary" : "primary"} sx={{ mx: 1 }}> <Typography color={updatingRam ? "secondary" : "primary"} sx={{ mx: 1 }}>
{ram} {ram}
</Typography> </Typography>
<Button onClick={save}>Save (Ctrl/Cmd + b)</Button> <Button onClick={save}>Save (CTRL/CMD + S)</Button>
<Typography sx={{ mx: 1 }}> <Typography sx={{ mx: 1 }}>
{" "} {" "}
Documentation:{" "} Documentation:{" "}