Skip to content

Commit

Permalink
dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
VargaJoe committed Nov 16, 2023
1 parent 2219aef commit a22b804
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion apps/sensenet/src/components/field-controls/html-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @module FieldControls
*/
import { InputLabel } from '@material-ui/core'
import { InputLabel, useTheme } from '@material-ui/core'
import { changeTemplatedValue, ReactClientFieldSetting } from '@sensenet/controls-react'
import React, { useState } from 'react'
import MonacoEditor from 'react-monaco-editor'
Expand All @@ -14,6 +14,7 @@ export const HtmlEditor: React.FC<ReactClientFieldSetting> = (props) => {
const initialState =
props.fieldValue || (props.actionName === 'new' && changeTemplatedValue(props.settings.DefaultValue)) || ''
const [value, setValue] = useState(initialState)
const theme = useTheme()

const readonly = props.actionName === 'browse' || props.settings.ReadOnly

Expand Down Expand Up @@ -69,6 +70,17 @@ export const HtmlEditor: React.FC<ReactClientFieldSetting> = (props) => {
showWords: true,
},
}}
theme={theme.palette.type === 'dark' ? 'admin-ui-dark' : 'vs-light'}
editorWillMount={(monaco) => {
monaco.editor.defineTheme('admin-ui-dark', {
base: 'vs-dark',
inherit: true,
rules: [],
colors: {
'editor.background': '#121212',
},
})
}}
/>
</>
)
Expand Down

0 comments on commit a22b804

Please sign in to comment.