add rudimentary Text editor

This commit is contained in:
GhostedGaming 2024-12-24 21:51:56 -05:00 committed by BitSyndicate
parent f18a77e1f7
commit e08b661cdd
Signed by: bitsyndicate
GPG key ID: 443E4198D6BBA6DE
6 changed files with 229 additions and 0 deletions

View file

@ -0,0 +1,27 @@
import React, { useState } from "react";
import Editor from "@monaco-editor/react";
const CodeEditorWindow = ({ onChange, language, code, theme }) => {
const [value, setValue] = useState(code || "");
const handleEditorChange = (value) => {
setValue(value);
onChange("code", value);
};
return (
<div className="overlay rounded-md overflow-hidden w-full h-full shadow-4xl">
<Editor
height="85vh"
width={`100%`}
language={language || "javascript"}
value={value}
theme={theme}
defaultValue="// some comment"
onChange={handleEditorChange}
/>
</div>
);
};
export default CodeEditorWindow;