From 7240bbe8b7fd6a7d571d3ff02bdd15c185b20d48 Mon Sep 17 00:00:00 2001 From: omuretsu <84951833+Snarling@users.noreply.github.com> Date: Tue, 30 May 2023 20:47:01 -0400 Subject: [PATCH] Fix hotfix --- src/ScriptEditor/ui/themes.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ScriptEditor/ui/themes.ts b/src/ScriptEditor/ui/themes.ts index d3ccadd1d..f96b281c1 100644 --- a/src/ScriptEditor/ui/themes.ts +++ b/src/ScriptEditor/ui/themes.ts @@ -1,6 +1,7 @@ import type { editor } from "monaco-editor"; import { getRecordKeys } from "../../Types/Record"; import { Settings } from "../../Settings/Settings"; +import { cloneDeep } from "lodash"; type DefineThemeFn = typeof editor.defineTheme; export interface IScriptEditorTheme { @@ -75,7 +76,7 @@ const colorRegExp = /^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/; // Invalid data will be replaced with FF0000 (bright red) export const sanitizeTheme = (theme: IScriptEditorTheme): void => { if (typeof theme !== "object") { - Settings.EditorTheme = defaultMonacoTheme; + Settings.EditorTheme = cloneDeep(defaultMonacoTheme); return; } for (const themeKey of getRecordKeys(theme)) { @@ -94,7 +95,7 @@ export const sanitizeTheme = (theme: IScriptEditorTheme): void => { for (const [blockKey, blockValue] of Object.entries(block) as [keyof T, unknown][]) { if (!blockValue || (typeof blockValue !== "string" && typeof blockValue !== "object")) (block[blockKey] as string) = "FF0000"; - else if (typeof blockValue === "object") repairBlock(block); + else if (typeof blockValue === "object") repairBlock(blockValue as Record); else if (!blockValue.match(colorRegExp)) (block[blockKey] as string) = "FF0000"; } };