mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Revert "CodeEditor: Ensure latest onChange callback is called" (#83677)
Revert "CodeEditor: Ensure latest onChange callback is called (#83599)"
This reverts commit 3363e3f2d3
.
This commit is contained in:
parent
f0822e0aef
commit
0fd46a1bd3
@ -102,7 +102,7 @@ class UnthemedCodeEditor extends PureComponent<Props> {
|
||||
};
|
||||
|
||||
handleOnMount = (editor: MonacoEditorType, monaco: Monaco) => {
|
||||
const { getSuggestions, language, onEditorDidMount } = this.props;
|
||||
const { getSuggestions, language, onChange, onEditorDidMount } = this.props;
|
||||
|
||||
this.modelId = editor.getModel()?.id;
|
||||
this.getEditorValue = () => editor.getValue();
|
||||
@ -119,21 +119,15 @@ class UnthemedCodeEditor extends PureComponent<Props> {
|
||||
}
|
||||
});
|
||||
|
||||
editor.getModel()?.onDidChangeContent(this.handleChangeContent);
|
||||
if (onChange) {
|
||||
editor.getModel()?.onDidChangeContent(() => onChange(editor.getValue()));
|
||||
}
|
||||
|
||||
if (onEditorDidMount) {
|
||||
onEditorDidMount(editor, monaco);
|
||||
}
|
||||
};
|
||||
|
||||
handleChangeContent = () => {
|
||||
const { onChange } = this.props;
|
||||
|
||||
if (onChange) {
|
||||
onChange(this.getEditorValue());
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { theme, language, width, height, showMiniMap, showLineNumbers, readOnly, monacoOptions } = this.props;
|
||||
const { alwaysConsumeMouseWheel, ...restMonacoOptions } = monacoOptions ?? {};
|
||||
|
Loading…
Reference in New Issue
Block a user