Skip to content

Commit b7803a8

Browse files
authored
Merge pull request #295 from oasisprotocol/mz/monacoTheme
Adjust Monaco editor to match the designs
2 parents 18492c9 + 06bd77a commit b7803a8

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/components/CodeDisplay/index.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ export const CodeDisplay: FC<CodeDisplayProps> = ({ data, className, readOnly =
5252
return null
5353
}
5454

55+
const handleEditorWillMount = (monaco: typeof import('monaco-editor')) => {
56+
monaco.editor.defineTheme('customTheme', {
57+
base: 'vs-dark',
58+
inherit: true,
59+
rules: [],
60+
colors: {
61+
'editor.background': '#18181B',
62+
},
63+
})
64+
}
65+
5566
const handleEditorDidMount = (editor: monaco.editor.IStandaloneCodeEditor) => {
5667
editorRef.current = editor
5768
}
@@ -95,13 +106,15 @@ export const CodeDisplay: FC<CodeDisplayProps> = ({ data, className, readOnly =
95106
loading={<TextAreaFallback value={data} />}
96107
language="yaml"
97108
value={data}
98-
theme="vs-dark"
109+
theme="customTheme"
110+
beforeMount={handleEditorWillMount}
99111
onMount={handleEditorDidMount}
100112
onChange={handleEditorChange}
101113
options={{
102114
readOnly,
103115
fontSize: 14,
104116
wordWrap: 'on',
117+
scrollBeyondLastLine: false,
105118
}}
106119
/>
107120
</Suspense>

0 commit comments

Comments
 (0)