Skip to content

Commit

Permalink
[Unified search] Fixes the theme for the editor on the dark mode (ela…
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula authored Aug 2, 2022
1 parent 943cde8 commit 514e5a7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import React, { useRef, memo, useEffect, useState, useCallback } from 'react';
import classNames from 'classnames';
import { EsqlLang, monaco } from '@kbn/monaco';
import { IDataPluginServices } from '@kbn/data-plugin/public';
import type { AggregateQuery } from '@kbn/es-query';
import { getAggregateQueryMode } from '@kbn/es-query';
import { useKibana } from '@kbn/kibana-react-plugin/public';

import { i18n } from '@kbn/i18n';
import {
Expand Down Expand Up @@ -94,6 +96,8 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
Array<{ startLineNumber: number; message: string }>
>([]);
const [documentationSections, setDocumentationSections] = useState<DocumentationSections>();
const kibana = useKibana<IDataPluginServices>();
const { uiSettings } = kibana.services;

const styles = textBasedLanguagedEditorStyles(
euiTheme,
Expand All @@ -103,6 +107,7 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
Boolean(errors?.length),
isCodeEditorExpandedFocused
);
const isDark = uiSettings.get('theme:darkMode');
const editorModel = useRef<monaco.editor.ITextModel>();
const editor1 = useRef<monaco.editor.IStandaloneCodeEditor>();
const containerRef = useRef<HTMLElement>(null);
Expand Down Expand Up @@ -303,7 +308,7 @@ export const TextBasedLanguagesEditor = memo(function TextBasedLanguagesEditor({
minimap: { enabled: false },
wordWrap: isWordWrapped ? 'on' : 'off',
lineNumbers: showLineNumbers ? 'on' : 'off',
theme: 'vs',
theme: isDark ? 'vs-dark' : 'vs',
lineDecorationsWidth: 12,
autoIndent: 'none',
wrappingIndent: 'none',
Expand Down

0 comments on commit 514e5a7

Please sign in to comment.