See also the CHANGELOG
v4
brings lots of new features and some breaking changes. First, let's see what's broken comparing with the v3
editorDidMount
- removed
In the new version there is no editorDidMount
property. Now it can be replaced by onMount
. If you happen to remember, the signature of editorDidMount
was function(getEditorValue: () => string, editor: monaco.editor.IStandaloneCodeEditor) => void
The onMount
prop is a little bit different, the signature is function(editor: monaco.editor.IStandaloneCodeEditor, monaco: Monaco) => void
. As you can see it also exposes the monaco
instance as a second parameter. There is no getEditorValue
. To get the current model value you can use editor
instance (editor.getValue()
) or onChange
prop. Read more
beforeMount
- new (onMount
- new)
In addition to onMount
now there is also beforeMount
that exposes the monaco
instance as a first parameter. Here you can do something before the editor is mounted. Read more
ControlledEditor
- removed
ControlledEditor
component is removed. Now there is one Editor
component that behaves in controlled
mode or uncontrolled
mode based on the usage of value
property. Read more
multi-model editor
- new
multi-model editor is supported now. Check this for simple demo. Read more
defaultPath
- new
Default path of the current model. Will be passed as the third argument to .createModel
method monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))
For DiffEditor
there are originalModelPath
and modifiedModelPath
path
- new
Path of the current model. Will be passed as the third argument to .createModel
method monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))
defaultLanguage
- new
Default language of the current model
useMonaco
- new
useMonaco
is a React
hook that returns the instance of the monaco
. Read more
onValidate
- new
onValidate
is an additional property. An event is emitted when the length of the model markers of the current model isn't 0. Read more
defaultProp
- new
The initial value of the default (auto created) model
monaco
utility - renamed
now, it's called loader
. Read more
onChange
- signature change
old - function(ev: any, value: string | undefined) => string | undefined
new - function(value: string | undefined, ev: monaco.editor.IModelContentChangedEvent) => void