From 55ac25b1a69f51c48def07caccdacc45211d2fbf Mon Sep 17 00:00:00 2001 From: Slinetrac Date: Sat, 15 Nov 2025 15:51:03 +0800 Subject: [PATCH] fix(editor): restore syntax highlighting for JS/CSS in Monaco editor --- src/components/profile/editor-viewer.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/profile/editor-viewer.tsx b/src/components/profile/editor-viewer.tsx index 64f2e1675..e6962f321 100644 --- a/src/components/profile/editor-viewer.tsx +++ b/src/components/profile/editor-viewer.tsx @@ -25,6 +25,15 @@ import { ReactNode, useEffect, useMemo, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import pac from "types-pac/pac.d.ts?raw"; +// Ensure Monaco language contributions are registered for proper syntax highlighting. +// - basic-languages registers the language ids and tokenizers +// - language/* contributions wire up workers and rich language features +// Without these, non-YAML editors (e.g. javascript/css) may appear uncolored. +import "monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution"; +import "monaco-editor/esm/vs/language/typescript/monaco.contribution"; +import "monaco-editor/esm/vs/basic-languages/css/css.contribution"; +import "monaco-editor/esm/vs/language/css/monaco.contribution"; + import { showNotice } from "@/services/noticeService"; import { useThemeMode } from "@/services/states"; import debounce from "@/utils/debounce";