@@ -9,18 +9,10 @@ import { ActionGroup, Alert, Button } from '@patternfly/react-core';
99import { DownloadIcon } from '@patternfly/react-icons/dist/esm/icons/download-icon' ;
1010import { Trans , useTranslation } from 'react-i18next' ;
1111import { useNavigate } from 'react-router-dom-v5-compat' ;
12- import {
13- FLAGS ,
14- ALL_NAMESPACES_KEY ,
15- SHOW_YAML_EDITOR_TOOLTIPS_USER_SETTING_KEY ,
16- SHOW_YAML_EDITOR_TOOLTIPS_LOCAL_STORAGE_KEY ,
17- SHOW_YAML_EDITOR_STICKY_SCROLL_USER_SETTING_KEY ,
18- SHOW_YAML_EDITOR_STICKY_SCROLL_LOCAL_STORAGE_KEY ,
19- } from '@console/shared/src/constants/common' ;
12+ import { FLAGS , ALL_NAMESPACES_KEY } from '@console/shared/src/constants/common' ;
2013import { getBadgeFromType } from '@console/shared/src/components/badges/badge-factory' ;
2114import { getResourceSidebarSamples } from '@console/shared/src/utils/sample-utils' ;
2215import { useTelemetry } from '@console/shared/src/hooks/useTelemetry' ;
23- import { useUserSettingsCompatibility } from '@console/shared/src/hooks/useUserSettingsCompatibility' ;
2416import { useResourceConnectionHandler } from '@console/shared/src/hooks/useResourceConnectionHandler' ;
2517
2618import PageBody from '@console/shared/src/components/layout/PageBody' ;
@@ -64,7 +56,7 @@ import { findOwner } from '../module/k8s/managed-by';
6456import { ClusterServiceVersionModel } from '@console/operator-lifecycle-manager/src/models' ;
6557import { definitionFor } from '../module/k8s/swagger' ;
6658import { ImportYAMLResults } from './import-yaml-results' ;
67- import { EditYamlSettingsModal } from './modals/edit-yaml-settings-modal' ;
59+ import { EditYamlSettingsModal , useEditYamlSettings } from './modals/edit-yaml-settings-modal' ;
6860import { CodeEditorControl } from '@patternfly/react-code-editor' ;
6961import { CompressIcon } from '@patternfly/react-icons/dist/js/icons/compress-icon' ;
7062import { ExpandIcon } from '@patternfly/react-icons/dist/js/icons/expand-icon' ;
@@ -73,6 +65,7 @@ import { RootState } from '@console/internal/redux';
7365import { getActiveNamespace } from '@console/internal/reducers/ui' ;
7466import { useOverlay } from '@console/dynamic-plugin-sdk/src/app/modal-support/useOverlay' ;
7567import { ErrorModal } from './modals/error-modal' ;
68+ import type { CodeEditorProps } from '@console/dynamic-plugin-sdk/src/extensions/console-types' ;
7669
7770const generateObjToLoad = (
7871 templateExtensions : Parameters < typeof getYAMLTemplates > [ 0 ] ,
@@ -189,19 +182,7 @@ const EditYAMLInner: React.FC<EditYAMLInnerProps> = (props) => {
189182 ) ,
190183 ) ;
191184
192- const [ showTooltips ] = useUserSettingsCompatibility (
193- SHOW_YAML_EDITOR_TOOLTIPS_USER_SETTING_KEY ,
194- SHOW_YAML_EDITOR_TOOLTIPS_LOCAL_STORAGE_KEY ,
195- true ,
196- true ,
197- ) ;
198-
199- const [ stickyScrollEnabled ] = useUserSettingsCompatibility (
200- SHOW_YAML_EDITOR_STICKY_SCROLL_USER_SETTING_KEY ,
201- SHOW_YAML_EDITOR_STICKY_SCROLL_LOCAL_STORAGE_KEY ,
202- true ,
203- true ,
204- ) ;
185+ const { theme, fontSize, showTooltips, stickyScrollEnabled } = useEditYamlSettings ( ) ;
205186
206187 const [ callbackCommand , setCallbackCommand ] = React . useState ( '' ) ;
207188 const [ showReplaceCodeModal , setShowReplaceCodeModal ] = React . useState ( false ) ;
@@ -803,7 +784,7 @@ const EditYAMLInner: React.FC<EditYAMLInnerProps> = (props) => {
803784 }
804785
805786 const readOnly = props . readOnly || notAllowed ;
806- const options = { readOnly, scrollBeyondLastLine : false } ;
787+ const options : CodeEditorProps [ 'options' ] = { fontSize , readOnly, scrollBeyondLastLine : false } ;
807788 const model = getModel ( props . obj ) ;
808789 const { samples, snippets } = model
809790 ? getResourceSidebarSamples ( model , yamlSamplesList , t )
@@ -876,9 +857,10 @@ const EditYAMLInner: React.FC<EditYAMLInnerProps> = (props) => {
876857 < div className = { css ( 'yaml-editor' , customClass ) } ref = { editor } >
877858 { showReplaceCodeModal && < ReplaceCodeModal handleCodeReplace = { handleCodeReplace } /> }
878859 < CodeEditor
860+ editorProps = { theme === 'default' ? undefined : { theme : `console-${ theme } ` } }
861+ options = { options }
879862 isCopyEnabled = { canDownload }
880863 ref = { monacoRef }
881- options = { options }
882864 showShortcuts = { ! genericYAML && ! isFullscreen }
883865 toolbarLinks = {
884866 sidebarSwitch
0 commit comments