-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add markdown gfm support and add markdown editor
- Loading branch information
1 parent
454522f
commit 9f24bb1
Showing
7 changed files
with
445 additions
and
29 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
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
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
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,21 @@ | ||
import React from 'react'; | ||
import { Editor } from '@bytemd/react'; | ||
import { plugins } from './plugins'; | ||
import 'bytemd/dist/index.css'; | ||
|
||
interface MarkdownEditorProps { | ||
value: string; | ||
onChange: (val: string) => void; | ||
} | ||
export const MarkdownEditor: React.FC<MarkdownEditorProps> = React.memo( | ||
(props) => { | ||
return ( | ||
<Editor | ||
plugins={plugins} | ||
value={props.value ?? ''} | ||
onChange={props.onChange} | ||
/> | ||
); | ||
} | ||
); | ||
MarkdownEditor.displayName = 'MarkdownEditor'; |
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,5 @@ | ||
import { Loadable } from '../Loadable'; | ||
|
||
export const MarkdownEditor = Loadable(() => | ||
import('./editor').then((module) => module.MarkdownEditor) | ||
); |
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,6 @@ | ||
import gfm from '@bytemd/plugin-gfm'; | ||
|
||
export const plugins = [ | ||
gfm(), | ||
// Add more plugins here | ||
]; |
Oops, something went wrong.