mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
hotfix broken editor shortcuts
This commit is contained in:
parent
ee5a70901b
commit
b67c03ff8a
4
dist/engine.bundle.js
vendored
4
dist/engine.bundle.js
vendored
File diff suppressed because one or more lines are too long
12
dist/vendor.bundle.js
vendored
12
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -28,19 +28,6 @@ import { dialogBoxCreate } from "../../utils/DialogBox";
|
|||||||
import { compareArrays } from "../../utils/helpers/compareArrays";
|
import { compareArrays } from "../../utils/helpers/compareArrays";
|
||||||
import { createElement } from "../../utils/uiHelpers/createElement";
|
import { createElement } from "../../utils/uiHelpers/createElement";
|
||||||
|
|
||||||
// TODO(hydroflame): move to Monaco mount/unmount
|
|
||||||
//Define key commands in script editor (ctrl o to save + close, etc.)
|
|
||||||
$(document).keydown(function(e) {
|
|
||||||
if (Settings.DisableHotkeys === true) {return;}
|
|
||||||
if (routing.isOn(Page.ScriptEditor)) {
|
|
||||||
//Ctrl + b
|
|
||||||
if (e.keyCode == 66 && (e.ctrlKey || e.metaKey)) {
|
|
||||||
e.preventDefault();
|
|
||||||
saveAndCloseScriptEditor(); // deleted function
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export function scriptCalculateOfflineProduction(runningScriptObj) {
|
export function scriptCalculateOfflineProduction(runningScriptObj) {
|
||||||
//The Player object stores the last update time from when we were online
|
//The Player object stores the last update time from when we were online
|
||||||
const thisUpdate = new Date().getTime();
|
const thisUpdate = new Date().getTime();
|
||||||
|
@ -57,6 +57,11 @@ interface IProps {
|
|||||||
engine: IEngine;
|
engine: IEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// How to load function definition in monaco
|
// How to load function definition in monaco
|
||||||
// https://github.com/Microsoft/monaco-editor/issues/1415
|
// https://github.com/Microsoft/monaco-editor/issues/1415
|
||||||
// https://microsoft.github.io/monaco-editor/api/modules/monaco.languages.html
|
// https://microsoft.github.io/monaco-editor/api/modules/monaco.languages.html
|
||||||
@ -230,6 +235,19 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
return () => clearInterval(id);
|
return () => clearInterval(id);
|
||||||
}, [code]);
|
}, [code]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function maybeSave(event: KeyboardEvent) {
|
||||||
|
if (Settings.DisableHotkeys) return;
|
||||||
|
//Ctrl + b
|
||||||
|
if (event.keyCode == 66 && (event.ctrlKey || event.metaKey)) {
|
||||||
|
event.preventDefault();
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.addEventListener('keydown', maybeSave);
|
||||||
|
return () => document.removeEventListener('keydown', maybeSave);
|
||||||
|
})
|
||||||
|
|
||||||
function onMount(editor: IStandaloneCodeEditor): void {
|
function onMount(editor: IStandaloneCodeEditor): void {
|
||||||
editorRef.current = editor;
|
editorRef.current = editor;
|
||||||
if(editorRef.current === null) return;
|
if(editorRef.current === null) return;
|
||||||
@ -257,7 +275,6 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, 'netscript.d.ts');
|
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, 'netscript.d.ts');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(options);
|
|
||||||
return (<div id="script-editor-wrapper">
|
return (<div id="script-editor-wrapper">
|
||||||
<div id="script-editor-filename-wrapper">
|
<div id="script-editor-filename-wrapper">
|
||||||
<p id="script-editor-filename-tag" className="noselect"> <strong style={{backgroundColor:'#555'}}>Script name: </strong></p>
|
<p id="script-editor-filename-tag" className="noselect"> <strong style={{backgroundColor:'#555'}}>Script name: </strong></p>
|
||||||
|
@ -145,7 +145,6 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
|||||||
Object.assign(Settings, defaultSettings);
|
Object.assign(Settings, defaultSettings);
|
||||||
},
|
},
|
||||||
load(saveString: string) {
|
load(saveString: string) {
|
||||||
console.log(saveString);
|
|
||||||
Object.assign(Settings, JSON.parse(saveString));
|
Object.assign(Settings, JSON.parse(saveString));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user