mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 06:32:26 +01:00
Merge pull request #1080 from danielyxie/dev
Fixed Script Editor not loading the same file after manually clicking it
This commit is contained in:
commit
8289c9fc75
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,
|
loadAllRunningScripts,
|
||||||
updateOnlineScriptTimes,
|
updateOnlineScriptTimes,
|
||||||
} from "./NetscriptWorker";
|
} from "./NetscriptWorker";
|
||||||
|
import { GetServerByHostname } from "./Server/ServerHelpers";
|
||||||
import { Player } from "./Player";
|
import { Player } from "./Player";
|
||||||
import { prestigeAugmentation } from "./Prestige";
|
import { prestigeAugmentation } from "./Prestige";
|
||||||
import {
|
import {
|
||||||
@ -226,6 +227,8 @@ const Engine = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
indexedDb: undefined,
|
indexedDb: undefined,
|
||||||
|
lastFilename: '',
|
||||||
|
lastFilenameServer: '',
|
||||||
|
|
||||||
// Time variables (milliseconds unix epoch time)
|
// Time variables (milliseconds unix epoch time)
|
||||||
_lastUpdate: new Date().getTime(),
|
_lastUpdate: new Date().getTime(),
|
||||||
@ -251,9 +254,17 @@ const Engine = {
|
|||||||
Engine.Display.scriptEditorContent.style.display = "block";
|
Engine.Display.scriptEditorContent.style.display = "block";
|
||||||
routing.navigateTo(Page.ScriptEditor);
|
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(
|
ReactDOM.render(
|
||||||
<ScriptEditorRoot filename={filename} code={code} player={Player} engine={this} />,
|
<ScriptEditorRoot filename={filename} code={code} player={Player} engine={this} />,
|
||||||
Engine.Display.scriptEditorContent,
|
Engine.Display.scriptEditorContent,
|
||||||
|
Loading…
Reference in New Issue
Block a user