Closed sam-rez closed 1 year ago
import React from "react";
import CodeMirror from "@uiw/react-codemirror";
import { EditorView } from "@codemirror/view";
import { javascript } from "@codemirror/lang-javascript";
const fontSize = EditorView.baseTheme({
"&": {
backgroundColor: "#fff",
fontSize: "34px"
}
});
export default function App() {
const onChange = React.useCallback((value, viewUpdate) => {
console.log("value:", value);
}, []);
return (
<div>
<CodeMirror
value="console.log('hello world!');"
height="200px"
theme="dark"
extensions={[fontSize, javascript({ jsx: true })]}
onChange={onChange}
/>
<CodeMirror
value="console.log('hello world!');"
height="200px"
extensions={[javascript({ jsx: true })]}
onChange={(value, viewUpdate) => {
console.log("value:", value);
}}
/>
</div>
);
}
Is this recommended over adding CSS class?
Is there a way setting to change font size? I'm on version 4.15.1