import { lazy, Suspense } from 'react' import type { DiffEditorProps, EditorProps } from '@monaco-editor/react' const MonacoEditor = lazy(async () => { const mod = await import('@monaco-editor/react') return { default: mod.default } }) const MonacoDiffEditor = lazy(async () => { const mod = await import('@monaco-editor/react') return { default: mod.DiffEditor } }) function MonacoLoading({ height, width, className, loading, }: { height?: string | number width?: string | number className?: string loading?: React.ReactNode }) { return (
{loading ?? (
正在加载编辑器...
)}
) } export function LazyEditor(props: EditorProps) { return ( } > ) } export function LazyDiffEditor(props: DiffEditorProps) { return ( } > ) }