这个问题是关于monaco-react library
当我输入“hello world”之类的内容时
现在:
但我想要:
我想绝对拦截输入,因为某些原因,readOnly没用
const [value, setValue] = useState('');
<MonacoEditor
theme="vs-light"
width={width}
height={height}
language={language}
value={value}
onMount={handleMount}
onChange={handleChange}
/>
const handleChange = (newValue) => {
// no changed
console.log(value);
// has changed
console.log(newValue);
// the editor has changed like the first picture
}
如何控制编辑器?