mirror of
https://litchi.icu/ngc2207/judge4c-demo.git
synced 2025-05-18 19:36:48 +00:00
feat: 在代码片段编辑表单中添加 Monaco Editor 组件
This commit is contained in:
parent
33a67a4763
commit
0d8974b9f3
@ -1,11 +1,22 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { Snippet } from "@prisma/client";
|
import { Snippet } from "@prisma/client";
|
||||||
|
import { Editor } from "@monaco-editor/react";
|
||||||
|
|
||||||
interface SnippetEditFormProps {
|
interface SnippetEditFormProps {
|
||||||
snippet: Snippet;
|
snippet: Snippet;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SnippetEditForm({ snippet }: SnippetEditFormProps) {
|
export default function SnippetEditForm({ snippet }: SnippetEditFormProps) {
|
||||||
return <div>Client component has snippet with title {snippet.title}</div>;
|
return (
|
||||||
|
<div>
|
||||||
|
<Editor
|
||||||
|
height="40vh"
|
||||||
|
theme="vs-light"
|
||||||
|
language="c"
|
||||||
|
defaultValue={snippet.code}
|
||||||
|
options={{ minimap: { enabled: false } }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user