Adapted PR #2055 to the refacted script editor code

This commit is contained in:
BuildTools 2021-12-20 01:21:37 -06:00
parent e5c4c8f64b
commit 6d90025370

@ -144,6 +144,13 @@ export function Root(props: IProps): React.ReactElement {
event.preventDefault(); event.preventDefault();
save(); save();
} }
// CTRL/CMD + S
if (event.code == `KeyS` && (event.ctrlKey || event.metaKey)) {
event.preventDefault();
event.stopPropagation();
save();
}
} }
document.addEventListener("keydown", maybeSave); document.addEventListener("keydown", maybeSave);
return () => document.removeEventListener("keydown", maybeSave); return () => document.removeEventListener("keydown", maybeSave);
@ -623,7 +630,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 & Close (Ctrl/Cmd + b)</Button> <Button onClick={save}>Save & Close (Ctrl/Cmd + s)</Button>
<Typography sx={{ mx: 1 }}> <Typography sx={{ mx: 1 }}>
{" "} {" "}
Documentation:{" "} Documentation:{" "}