refactor(editor): update editor configuration paths and values

This commit is contained in:
cfngc4594 2025-02-25 14:39:55 +08:00
parent d51c324ea9
commit 50d1f4cf8e
3 changed files with 8 additions and 8 deletions

View File

@ -5,12 +5,12 @@ import dynamic from "next/dynamic";
import { useTheme } from "next-themes";
import normalizeUrl from "normalize-url";
import { highlighter } from "@/lib/shiki";
import { DEFAULT_PATH } from "@/config/path";
import { DEFAULT_VALUE } from "@/config/value";
import { shikiToMonaco } from "@shikijs/monaco";
import { Skeleton } from "@/components/ui/skeleton";
import { CODE_EDITOR_OPTIONS } from "@/constants/option";
import { SUPPORTED_LANGUAGE_SERVERS } from "@/config/language-server";
import { DEFAULT_EDITOR_PATH } from "@/config/editor/path";
import { DEFAULT_EDITOR_VALUE } from "@/config/editor/value";
import { SUPPORTED_LANGUAGE_SERVERS } from "@/config/lsp/language-server";
import { useCodeEditorOption, useCodeEditorState } from "@/store/useCodeEditor";
import { toSocket, WebSocketMessageReader, WebSocketMessageWriter } from "vscode-ws-jsonrpc";
@ -100,8 +100,8 @@ export default function CodeEditor() {
return (
<Editor
defaultLanguage={language}
defaultValue={DEFAULT_VALUE[language]}
path={DEFAULT_PATH[language]}
defaultValue={DEFAULT_EDITOR_VALUE[language]}
path={DEFAULT_EDITOR_PATH[language]}
theme={resolvedTheme === "light" ? "github-light-default" : "github-dark-default"}
className="h-full"
options={mergeOptions}

View File

@ -46,7 +46,7 @@ export default function MdxPreview({ source }: MdxPreviewProps) {
className: ["subheading-anchor"],
ariaLabel: "Link to section",
},
}
},
],
[
rehypePretty,

View File

@ -1,6 +1,6 @@
import { create } from "zustand";
import * as monaco from "monaco-editor";
import { DEFAULT_LANGUAGE } from "@/config/language";
import { DEFAULT_EDITOR_LANGUAGE } from "@/config/editor/language";
import { CODE_EDITOR_OPTIONS } from "@/constants/option";
import { SupportedLanguage } from "@/constants/language";
import { MonacoLanguageClient } from "monaco-languageclient";
@ -16,7 +16,7 @@ interface CodeEditorState {
export const useCodeEditorState = create<CodeEditorState>((set) => ({
editor: null,
language: DEFAULT_LANGUAGE,
language: DEFAULT_EDITOR_LANGUAGE,
languageClient: null,
setEditor: (editor) => set({ editor }),
setLanguage: (language) => set({ language }),