mirror of
https://github.com/suren-atoyan/monaco-react.git
synced 2026-01-25 16:02:35 +00:00
Merge pull request #78 from psrok1/fix/options-effects-order
Fix `readOnly` mode option check
This commit is contained in:
commit
d24bf693fd
@ -28,7 +28,11 @@ const Editor =
|
||||
});
|
||||
|
||||
useUpdate(_ => {
|
||||
if (options.readOnly) {
|
||||
editorRef.current.updateOptions(options);
|
||||
}, [options], isEditorReady);
|
||||
|
||||
useUpdate(_ => {
|
||||
if (editorRef.current.getOption(monacoRef.current.editor.EditorOption.readOnly)) {
|
||||
editorRef.current.setValue(value);
|
||||
} else {
|
||||
editorRef.current.executeEdits('', [{
|
||||
@ -60,10 +64,6 @@ const Editor =
|
||||
monacoRef.current.editor.setTheme(theme);
|
||||
}, [theme], isEditorReady);
|
||||
|
||||
useUpdate(_ => {
|
||||
editorRef.current.updateOptions(options);
|
||||
}, [options], isEditorReady);
|
||||
|
||||
const createEditor = useCallback(_ => {
|
||||
editorRef.current = monacoRef.current.editor.create(containerRef.current, {
|
||||
value,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user