diff --git a/src/constants/option.ts b/src/constants/option.ts index af32043..dfcfd73 100644 --- a/src/constants/option.ts +++ b/src/constants/option.ts @@ -1,6 +1,6 @@ -import * as monaco from "monaco-editor" +import { type editor } from "monaco-editor"; -export const CODE_EDITOR_OPTIONS: monaco.editor.IEditorConstructionOptions = { +export const CODE_EDITOR_OPTIONS: editor.IEditorConstructionOptions = { autoIndent: "full", automaticLayout: true, contextmenu: true, diff --git a/src/store/useCodeEditor.ts b/src/store/useCodeEditor.ts index aae083e..e193da4 100644 --- a/src/store/useCodeEditor.ts +++ b/src/store/useCodeEditor.ts @@ -1,5 +1,5 @@ import { create } from "zustand"; -import * as monaco from "monaco-editor"; +import { type editor } from "monaco-editor"; import { CODE_EDITOR_OPTIONS } from "@/constants/option"; import { SupportedLanguage } from "@/constants/language"; import { MonacoLanguageClient } from "monaco-languageclient"; @@ -7,12 +7,12 @@ import { persist, createJSONStorage } from "zustand/middleware"; import { DEFAULT_EDITOR_LANGUAGE } from "@/config/editor/language"; interface CodeEditorState { - editor: monaco.editor.IStandaloneCodeEditor | null; + editor: editor.IStandaloneCodeEditor | null; language: SupportedLanguage; languageClient: MonacoLanguageClient | null; loading: boolean; result: string | null; - setEditor: (editor: monaco.editor.IStandaloneCodeEditor | null) => void; + setEditor: (editor: editor.IStandaloneCodeEditor | null) => void; setLanguage: (language: SupportedLanguage) => void; setLanguageClient: (languageClient: MonacoLanguageClient | null) => void; setLoading: (loading: boolean) => void; @@ -41,7 +41,7 @@ export const useCodeEditorState = create()( ) ); -export const useCodeEditorOption = create((set) => ({ +export const useCodeEditorOption = create((set) => ({ fontSize: CODE_EDITOR_OPTIONS.fontSize, lineHeight: CODE_EDITOR_OPTIONS.lineHeight, setFontSize: (fontSize: number) => set({ fontSize }),