MonacoEditor: set font to Roboto mono (#98672)

set default code editor font to roboto mono
This commit is contained in:
Ashley Harrison 2025-01-09 10:44:07 +00:00 committed by GitHub
parent f75bbe9f43
commit 42f6f917c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,7 +11,7 @@ import type { ReactMonacoEditorProps } from './types';
monacoEditorLoader.config({ monaco });
export const ReactMonacoEditor = (props: ReactMonacoEditorProps) => {
const { beforeMount } = props;
const { beforeMount, options, ...restProps } = props;
const theme = useTheme2();
const onMonacoBeforeMount = useCallback(
@ -23,6 +23,14 @@ export const ReactMonacoEditor = (props: ReactMonacoEditorProps) => {
);
return (
<Editor {...props} theme={theme.isDark ? 'grafana-dark' : 'grafana-light'} beforeMount={onMonacoBeforeMount} />
<Editor
{...restProps}
options={{
...options,
fontFamily: theme.typography.code.fontFamily,
}}
theme={theme.isDark ? 'grafana-dark' : 'grafana-light'}
beforeMount={onMonacoBeforeMount}
/>
);
};