From 6e371ce5a6717774bff5cdd70a7a882523c9298c Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Thu, 9 Jun 2022 13:55:42 +0800 Subject: [PATCH] fix: fix EditorView.theme undefined. --- src/useCodeMirror.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/useCodeMirror.ts b/src/useCodeMirror.ts index 51e46f741..7f184a5c5 100644 --- a/src/useCodeMirror.ts +++ b/src/useCodeMirror.ts @@ -5,7 +5,6 @@ import { indentWithTab } from '@codemirror/commands'; import { EditorView, keymap, ViewUpdate, placeholder } from '@codemirror/view'; import { oneDark } from '@codemirror/theme-one-dark'; import { ReactCodeMirrorProps } from './'; -import { defaultLightThemeOption } from './theme/light'; export interface UseCodeMirror extends ReactCodeMirrorProps { container?: HTMLDivElement | null; @@ -36,6 +35,16 @@ export function useCodeMirror(props: UseCodeMirror) { const [container, setContainer] = useState(props.container); const [view, setView] = useState(); const [state, setState] = useState(); + const defaultLightThemeOption = EditorView.theme( + { + '&': { + backgroundColor: '#fff', + }, + }, + { + dark: false, + }, + ); const defaultThemeOption = EditorView.theme({ '&': { height,