feat(editor): update loading state with padding and refactor dynamic import

This commit is contained in:
cfngc4594 2025-03-04 21:26:51 +08:00
parent 0c1ecbcff2
commit d89a45daa8

View File

@ -11,6 +11,7 @@ import { connectToLanguageServer } from "@/lib/language-server";
import { LanguageServerMetadata } from "@/types/language-server";
import type { MonacoLanguageClient } from "monaco-languageclient";
// Dynamically import Monaco Editor with SSR disabled
const Editor = dynamic(
async () => {
await import("vscode");
@ -21,7 +22,11 @@ const Editor = dynamic(
},
{
ssr: false,
loading: () => <Skeleton className="h-full w-full rounded-3xl" />
loading: () => (
<div className="h-full w-full p-2">
<Skeleton className="h-full w-full rounded-3xl" />
</div>
),
}
);
@ -112,7 +117,11 @@ export default function CoreEditorLsp({
beforeMount={handleEditorWillMount}
onMount={handleEditorDidMount}
options={editorConfig}
loading={<Skeleton className="h-full w-full rounded-3xl" />}
loading={
<div className="h-full w-full p-2">
<Skeleton className="h-full w-full rounded-3xl" />
</div>
}
/>
);
}