mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-18 07:18:38 +02:00
fix editor not loading files
This commit is contained in:
@@ -333,20 +333,19 @@ export function Root(props: IProps): React.ReactElement {
|
||||
|
||||
if (editorRef.current === null || monacoRef.current === null) return;
|
||||
|
||||
if (!props.files && currentScript !== null) {
|
||||
// Open currentscript
|
||||
regenerateModel(currentScript);
|
||||
editorRef.current.setModel(currentScript.model);
|
||||
editorRef.current.setPosition(currentScript.lastPosition);
|
||||
editorRef.current.revealLineInCenter(currentScript.lastPosition.lineNumber);
|
||||
updateRAM(currentScript.code);
|
||||
editorRef.current.focus();
|
||||
return;
|
||||
}
|
||||
if (props.files) {
|
||||
const files = Object.entries(props.files);
|
||||
|
||||
if (!files.length && currentScript !== null) {
|
||||
// Open currentscript
|
||||
regenerateModel(currentScript);
|
||||
editorRef.current.setModel(currentScript.model);
|
||||
editorRef.current.setPosition(currentScript.lastPosition);
|
||||
editorRef.current.revealLineInCenter(currentScript.lastPosition.lineNumber);
|
||||
updateRAM(currentScript.code);
|
||||
editorRef.current.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!files.length) {
|
||||
editorRef.current.focus();
|
||||
return;
|
||||
@@ -383,6 +382,8 @@ export function Root(props: IProps): React.ReactElement {
|
||||
updateRAM(newScript.code);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log("here we need to load something if we can");
|
||||
}
|
||||
|
||||
editorRef.current.focus();
|
||||
|
||||
Reference in New Issue
Block a user