File size: 1,098 Bytes
20ec4ad 969b550 20ec4ad 969b550 20ec4ad 8a0e39e 20ec4ad 969b550 20ec4ad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import Editor from "@monaco-editor/react";
import Tabs from "../tabs/tabs";
import { editor } from "monaco-editor";
import { RefObject } from "react";
export default function EditorPanel({
html,
setHtml,
isAiWorking,
setError,
editorRef,
}: {
html: string;
setHtml: (h: string) => void;
isAiWorking: boolean;
setError: (e: boolean) => void;
editorRef: RefObject<editor.IStandaloneCodeEditor | null>;
}) {
return (
<div className="h-full flex flex-col">
<Tabs />
<div className="flex-1">
<Editor
language="html"
theme="vs-dark"
value={html}
onValidate={(markers) => setError(markers.length > 0)}
onChange={(v) => setHtml(v ?? "")}
onMount={(editor) => {
if (editorRef) {
editorRef.current = editor;
}
}}
options={{
readOnly: isAiWorking,
minimap: { enabled: false },
scrollBeyondLastLine: false,
}}
width="100%"
height="100%"
/>
</div>
</div>
);
}
|