mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
Revert "Add keycode table and switch to event.code in select places" (#224)
Using code instead of key is strongly warned against at MDN and causes issues with nonstandard layouts:
https://developer.mozilla.org/en-US/docs/Web/API/Element/keydown_event#keyboardevent.code
This also fixes ScriptEditorRoot.tsx, where some code snuck in that
wasn't using *any* of the constants.
This reverts commit 016a9a873f.
This commit is contained in:
@@ -4,6 +4,7 @@ import * as monaco from "monaco-editor";
|
||||
|
||||
type IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor;
|
||||
type ITextModel = monaco.editor.ITextModel;
|
||||
import { KEY } from "../../utils/helpers/keyCodes";
|
||||
import { OptionsModal } from "./OptionsModal";
|
||||
import { Options } from "./Options";
|
||||
import { isValidFilePath } from "../../Terminal/DirectoryHelpers";
|
||||
@@ -152,13 +153,13 @@ export function Root(props: IProps): React.ReactElement {
|
||||
function keydown(event: KeyboardEvent): void {
|
||||
if (Settings.DisableHotkeys) return;
|
||||
//Ctrl + b
|
||||
if (event.code == "KeyB" && (event.ctrlKey || event.metaKey)) {
|
||||
if (event.key == KEY.B && (event.ctrlKey || event.metaKey)) {
|
||||
event.preventDefault();
|
||||
Router.toTerminal();
|
||||
}
|
||||
|
||||
// CTRL/CMD + S
|
||||
if (event.code == "KeyS" && (event.ctrlKey || event.metaKey)) {
|
||||
if (event.key == KEY.S && (event.ctrlKey || event.metaKey)) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
save();
|
||||
|
||||
Reference in New Issue
Block a user