mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Grafana-UI: allow pass through of monaco options (#32763)
This commit is contained in:
@@ -64,7 +64,7 @@ class UnthemedCodeEditor extends React.PureComponent<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { theme, language, width, height, showMiniMap, showLineNumbers, readOnly } = this.props;
|
||||
const { theme, language, width, height, showMiniMap, showLineNumbers, readOnly, monacoOptions } = this.props;
|
||||
const value = this.props.value ?? '';
|
||||
const longText = value.length > 100;
|
||||
|
||||
@@ -97,7 +97,10 @@ class UnthemedCodeEditor extends React.PureComponent<Props> {
|
||||
language={language}
|
||||
theme={theme.isDark ? 'vs-dark' : 'vs-light'}
|
||||
value={value}
|
||||
options={options}
|
||||
options={{
|
||||
...options,
|
||||
...(monacoOptions ?? {}),
|
||||
}}
|
||||
editorWillMount={this.editorWillMount}
|
||||
editorDidMount={this.editorDidMount}
|
||||
/>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
|
||||
export type CodeEditorChangeHandler = (value: string) => void;
|
||||
export type CodeEditorSuggestionProvider = () => CodeEditorSuggestionItem[];
|
||||
|
||||
@@ -10,6 +12,7 @@ export interface CodeEditorProps {
|
||||
readOnly?: boolean;
|
||||
showMiniMap?: boolean;
|
||||
showLineNumbers?: boolean;
|
||||
monacoOptions?: monaco.editor.IEditorConstructionOptions;
|
||||
|
||||
/**
|
||||
* Callback after the editor has mounted that gives you raw access to monaco
|
||||
|
||||
Reference in New Issue
Block a user