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,27 +70,26 @@ export default function CodeEditor() {
}, []); }, []);
return ( return (
<div className="h-screen flex flex-col"> <DynamicEditor
<DynamicEditor defaultLanguage="c"
theme={ defaultValue="# include<stdio.h>"
resolvedTheme === "light" path="file:///main.c"
? "github-light-default" theme={
: "github-dark-default" resolvedTheme === "light"
} ? "github-light-default"
defaultLanguage="c" : "github-dark-default"
defaultValue="# include<stdio.h>" }
path="file:///main.c" height="100%"
beforeMount={(monaco) => { options={{ automaticLayout: true }}
shikiToMonaco(highlighter, monaco); beforeMount={(monaco) => {
}} shikiToMonaco(highlighter, monaco);
onValidate={(markers) => { }}
markers.forEach((marker) => onValidate={(markers) => {
console.log("onValidate:", marker.message) markers.forEach((marker) =>
); 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>
); );
} }