File tree 3 files changed +8
-10
lines changed
3 files changed +8
-10
lines changed Original file line number Diff line number Diff line change
1
+ import MonacoEditor from '@monaco-editor/react' ;
2
+ import React from 'react' ;
3
+ export default function BaseEditor ( props ) {
4
+ // prevents light/dark mode flicker
5
+ const darkMode = document . documentElement . classList . contains ( 'dark' ) ;
6
+ return < MonacoEditor { ...props } theme = { darkMode ? 'vs-dark' : 'light' } /> ;
7
+ }
Original file line number Diff line number Diff line change @@ -93,13 +93,6 @@ export default function EditorPage(props: PageProps): JSX.Element {
93
93
< EditorTopNav />
94
94
95
95
{ typeof window !== 'undefined' && (
96
- // <React.Suspense
97
- // fallback={
98
- // <div className="text-center mt-6 font-bold text-2xl">
99
- // Loading
100
- // </div>
101
- // }
102
- // >
103
96
< StyledSplit
104
97
className = "h-full relative flex-1 overflow-hidden"
105
98
onDrag = { ( ) => {
@@ -123,7 +116,6 @@ export default function EditorPage(props: PageProps): JSX.Element {
123
116
</ div >
124
117
</ div >
125
118
</ StyledSplit >
126
- // </React.Suspense>
127
119
) }
128
120
</ div >
129
121
</ Layout >
Original file line number Diff line number Diff line change @@ -18,8 +18,7 @@ import {
18
18
import { DarkModeContext } from '../../context/DarkModeContext' ;
19
19
import EditorTabBar from './EditorTabBar' ;
20
20
import { conf as mdxConf , language as mdxLang } from './mdx-lang' ;
21
-
22
- const Editor = React . lazy ( ( ) => import ( '@monaco-editor/react' ) ) ;
21
+ const Editor = React . lazy ( ( ) => import ( './BaseEditor' ) ) ;
23
22
24
23
export const MainEditorInterface = ( { className } ) : JSX . Element => {
25
24
const activeFile = useAtomValue ( activeFileAtom ) ;
You can’t perform that action at this time.
0 commit comments