Skip to content

Commit efca8ed

Browse files
committedDec 12, 2022
fix: provide none option for theme. #431
1 parent 29581b5 commit efca8ed

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed
 

‎core/src/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface ReactCodeMirrorProps
2828
* `light` / `dark` / `Extension` Defaults to `light`.
2929
* @default light
3030
*/
31-
theme?: 'light' | 'dark' | Extension;
31+
theme?: 'light' | 'dark' | 'none' | Extension;
3232
/**
3333
* Whether to optional basicSetup by default
3434
* @default true

‎core/src/useCodeMirror.ts

+2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ export function useCodeMirror(props: UseCodeMirror) {
9191
case 'dark':
9292
getExtensions.push(oneDark);
9393
break;
94+
case 'none':
95+
break;
9496
default:
9597
getExtensions.push(theme);
9698
break;

‎www/src/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { ColorDoc } from './pages/extensions/color';
1818
import { MentionsDoc } from './pages/extensions/mentions';
1919
import { ThemesAllDoc } from './pages/extensions/themes';
2020
import { ZebraStripesDoc } from './pages/extensions/zebra-stripes';
21+
import { PageExample431 } from './pages/examples/Example431';
2122

2223
export const GlobalStyle = createGlobalStyle`
2324
[data-color-mode*='dark'], [data-color-mode*='dark'] body {
@@ -93,6 +94,9 @@ root.render(
9394
<Route path="mentions" element={<MentionsDoc />} />
9495
<Route path="zebra-stripes" element={<ZebraStripesDoc />} />
9596
</Route>
97+
<Route path="/examples/" element={<ExtensionsLayout />}>
98+
<Route path="431" element={<PageExample431 />} />
99+
</Route>
96100
</Routes>
97101
</HashRouter>,
98102
);

‎www/src/pages/examples/Example431.tsx

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import CodeMirror from '@uiw/react-codemirror';
2+
import { langs } from '@uiw/codemirror-extensions-langs';
3+
import { Fragment } from 'react';
4+
5+
/**
6+
* https://github.com/uiwjs/react-codemirror/issues/431
7+
*/
8+
export const PageExample431 = () => {
9+
return (
10+
<Fragment>
11+
<h1>How to remove all syntax highlighting?</h1>
12+
<CodeMirror
13+
value={`console.log('hello')`}
14+
theme="none"
15+
height="400px"
16+
style={{ margin: '0 0 23px 0' }}
17+
extensions={[langs.markdown()]}
18+
/>
19+
</Fragment>
20+
);
21+
};

0 commit comments

Comments
 (0)
Please sign in to comment.