Skip to content

Commit

Permalink
fix: fix EditorView.theme undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 9, 2022
1 parent abbc1ad commit 6e371ce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/useCodeMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -36,6 +35,16 @@ export function useCodeMirror(props: UseCodeMirror) {
const [container, setContainer] = useState(props.container);
const [view, setView] = useState<EditorView>();
const [state, setState] = useState<EditorState>();
const defaultLightThemeOption = EditorView.theme(
{
'&': {
backgroundColor: '#fff',
},
},
{
dark: false,
},
);
const defaultThemeOption = EditorView.theme({
'&': {
height,
Expand Down

0 comments on commit 6e371ce

Please sign in to comment.