-
-
Notifications
You must be signed in to change notification settings - Fork 155
Closed
Description
Is there any sample that shows how to set some lines as readonly, so it can't be edited?
I found something related to markText and beforeChange, but I couldn't solve it yet using @uiw/react-codemirror package.
https://stackoverflow.com/questions/17415100/codemirror-particular-lines-readonly
Thanks in advance!
PS: If possible, use the getting started sample as base and set only the first line as readonly:
import CodeMirror from '@uiw/react-codemirror';
import { javascript } from '@codemirror/lang-javascript';
const CodeEditor = () => {
return (
<CodeMirror
value="console.log('hello world!');"
height="200px"
extensions={[javascript({ jsx: true })]}
onChange={(value, viewUpdate) => {
console.log('value:', value);
console.log(viewUpdate);
}}
theme={'dark'}
/>
);
}
export default CodeEditor;Metadata
Metadata
Assignees
Labels
No labels