Skip to content

Commit

Permalink
website: add example. #665
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 21, 2024
1 parent 29d50d1 commit ac9cfd4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
35 changes: 35 additions & 0 deletions www/src/pages/examples/Example674.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import CodeMirror from '@uiw/react-codemirror';
import { EditorView } from '@uiw/react-codemirror';
import { Fragment, useCallback, useState } from 'react';

const code = `## Title
[weisit ulr](https://uiwjs.github.io/react-codemirror/)
four
**Bold text**
`;

/**
* https://github.com/uiwjs/react-codemirror/issues/674
*/
export function Component() {
const [value, setValue] = useState(code);

const onChange = useCallback((val: string) => {
setValue(val);
}, []);

return (
<Fragment>
<CodeMirror
value={value}
theme="none"
height="400px !important"
width="100%"
onChange={onChange}
style={{ margin: '0 0 23px 0', flex: 1 }}
extensions={[EditorView.contentAttributes.of({ spellcheck: 'true' })]}
/>
</Fragment>
);
}
5 changes: 5 additions & 0 deletions www/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,11 @@ export const routes: MenuRouteObject[] = [
label: 'How to remove all syntax highlighting?',
lazy: () => import('./pages/examples/Example431'),
},
{
path: '674',
label: 'Browser spell checking',
lazy: () => import('./pages/examples/Example674'),
},
{
path: '455',
label: 'CodeMirrorMerge use theme',
Expand Down

0 comments on commit ac9cfd4

Please sign in to comment.