feat(code-editor): use default file path for code editor based on language

This commit is contained in:
cfngc4594 2025-02-23 16:11:53 +08:00
parent 545f094f49
commit 6f2d853531

View File

@ -5,6 +5,7 @@ import dynamic from "next/dynamic";
import { useTheme } from "next-themes"; import { useTheme } from "next-themes";
import normalizeUrl from "normalize-url"; import normalizeUrl from "normalize-url";
import { highlighter } from "@/lib/shiki"; import { highlighter } from "@/lib/shiki";
import { DEFAULT_PATH } from "@/config/path";
import { DEFAULT_VALUE } from "@/config/value"; import { DEFAULT_VALUE } from "@/config/value";
import { shikiToMonaco } from "@shikijs/monaco"; import { shikiToMonaco } from "@shikijs/monaco";
import { Skeleton } from "@/components/ui/skeleton"; import { Skeleton } from "@/components/ui/skeleton";
@ -99,7 +100,7 @@ export default function CodeEditor() {
<Editor <Editor
defaultLanguage={language} defaultLanguage={language}
defaultValue={DEFAULT_VALUE[language]} defaultValue={DEFAULT_VALUE[language]}
path="file:///main.c" path={DEFAULT_PATH[language]}
theme={resolvedTheme === "light" ? "github-light-default" : "github-dark-default"} theme={resolvedTheme === "light" ? "github-light-default" : "github-dark-default"}
className="h-[calc(100vh-56px)]" className="h-[calc(100vh-56px)]"
options={mergeOptions} options={mergeOptions}