[v10.1.x] CodeEditor: Correctly fires onChange handler (#73261)
CodeEditor: Correctly fires onChange handler (#73030)
move onChange outside onEditorDidMount condition
(cherry picked from commit 57d8997b86)
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
co-authored by
Ashley Harrison
parent
e56b01975c
commit
b8556eab5f
@@ -111,9 +111,12 @@ class UnthemedCodeEditor extends PureComponent<Props> {
|
||||
|
||||
const languagePromise = this.loadCustomLanguage();
|
||||
|
||||
if (onChange) {
|
||||
editor.getModel()?.onDidChangeContent(() => onChange(editor.getValue()));
|
||||
}
|
||||
|
||||
if (onEditorDidMount) {
|
||||
languagePromise.then(() => onEditorDidMount(editor, monaco));
|
||||
editor.getModel()?.onDidChangeContent(() => onChange?.(editor.getValue()));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user