feat(code-editor): refactor layout structure and improve editor height handling

This commit is contained in:
cfngc4594 2025-02-20 00:59:53 +08:00
parent 423951ec58
commit 63501a3f6c

View File

@ -70,16 +70,17 @@ export default function CodeEditor() {
}, []); }, []);
return ( return (
<div className="h-screen flex flex-col">
<DynamicEditor <DynamicEditor
defaultLanguage="c"
defaultValue="# include<stdio.h>"
path="file:///main.c"
theme={ theme={
resolvedTheme === "light" resolvedTheme === "light"
? "github-light-default" ? "github-light-default"
: "github-dark-default" : "github-dark-default"
} }
defaultLanguage="c" height="100%"
defaultValue="# include<stdio.h>" options={{ automaticLayout: true }}
path="file:///main.c"
beforeMount={(monaco) => { beforeMount={(monaco) => {
shikiToMonaco(highlighter, monaco); shikiToMonaco(highlighter, monaco);
}} }}
@ -88,9 +89,7 @@ export default function CodeEditor() {
console.log("onValidate:", marker.message) console.log("onValidate:", marker.message)
); );
}} }}
options={{ automaticLayout: true }}
loading={<Skeleton className="h-full w-full p-4" />} loading={<Skeleton className="h-full w-full p-4" />}
/> />
</div>
); );
} }