-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29d50d1
commit ac9cfd4
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters