mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
Fixed Script Editor not loading the same file after manually clicking it
This commit is contained in:
parent
a564957092
commit
d66e36b637
4
dist/engine.bundle.js
vendored
4
dist/engine.bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -57,6 +57,7 @@ import {
|
||||
loadAllRunningScripts,
|
||||
updateOnlineScriptTimes,
|
||||
} from "./NetscriptWorker";
|
||||
import { GetServerByHostname } from "./Server/ServerHelpers";
|
||||
import { Player } from "./Player";
|
||||
import { prestigeAugmentation } from "./Prestige";
|
||||
import {
|
||||
@ -226,6 +227,8 @@ const Engine = {
|
||||
},
|
||||
|
||||
indexedDb: undefined,
|
||||
lastFilename: '',
|
||||
lastFilenameServer: '',
|
||||
|
||||
// Time variables (milliseconds unix epoch time)
|
||||
_lastUpdate: new Date().getTime(),
|
||||
@ -251,9 +254,17 @@ const Engine = {
|
||||
Engine.Display.scriptEditorContent.style.display = "block";
|
||||
routing.navigateTo(Page.ScriptEditor);
|
||||
|
||||
if(filename !== "") {
|
||||
this.lastFilename = filename;
|
||||
this.lastFilenameServer = Player.getCurrentServer().hostname;
|
||||
} else if(this.lastFilename !== '') {
|
||||
const scripts = GetServerByHostname(this.lastFilenameServer).scripts.filter(x => x.filename === this.lastFilename);
|
||||
if(scripts.length === 1) {
|
||||
filename = this.lastFilename;
|
||||
code = scripts[0].code;
|
||||
}
|
||||
}
|
||||
|
||||
const monaco = document.getElementById('monaco-editor');
|
||||
//https://www.npmjs.com/package/@monaco-editor/react#development-playground
|
||||
ReactDOM.render(
|
||||
<ScriptEditorRoot filename={filename} code={code} player={Player} engine={this} />,
|
||||
Engine.Display.scriptEditorContent,
|
||||
|
Loading…
Reference in New Issue
Block a user