diff --git a/src/Script/Script.ts b/src/Script/Script.ts index 6794cd11b..9e427ad3f 100644 --- a/src/Script/Script.ts +++ b/src/Script/Script.ts @@ -82,7 +82,7 @@ export class Script implements ContentFile { * @param hostname The server to save the script to */ saveScript(filename: ScriptFilePath, code: string, hostname: string): void { - this.code = Script.formatCode(code); + this.code = code; this.invalidateModule(); this.filename = filename; this.server = hostname; @@ -129,15 +129,6 @@ export class Script implements ContentFile { static fromJSON(value: IReviverValue): Script { return Generic_fromJSON(Script, value.data, Script.savedKeys); } - - /** - * Formats code: Removes the starting & trailing whitespace - * @param {string} code - The code to format - * @returns The formatted code - */ - static formatCode(code: string): string { - return code.replace(/^\s+|\s+$/g, ""); - } } constructorsForReviver.Script = Script; diff --git a/src/ScriptEditor/ui/ScriptEditorRoot.tsx b/src/ScriptEditor/ui/ScriptEditorRoot.tsx index 7d8ed4796..35fa3e5ad 100644 --- a/src/ScriptEditor/ui/ScriptEditorRoot.tsx +++ b/src/ScriptEditor/ui/ScriptEditorRoot.tsx @@ -593,9 +593,7 @@ export function Root(props: IProps): React.ReactElement { const openScript = openScripts[index]; const serverData = getServerCode(index); if (serverData === null) return " *"; - // For scripts, server code is stored with its starting & trailing whitespace removed - const code = openScript.isTxt ? openScript.code : Script.formatCode(openScript.code); - return serverData !== code ? " *" : ""; + return serverData !== openScript.code ? " *" : ""; } function getServerCode(index: number): string | null { const openScript = openScripts[index]; diff --git a/src/utils/v1APIBreak.ts b/src/utils/v1APIBreak.ts index b43fb8d42..2e8f77983 100644 --- a/src/utils/v1APIBreak.ts +++ b/src/utils/v1APIBreak.ts @@ -73,7 +73,7 @@ function convert(code: string): string { out.push(line); } code = out.join("\n"); - return Script.formatCode(code); + return code; } export function AwardNFG(n = 1): void {