@@ -3,10 +3,13 @@ componentId: markdown_editor
33title : MarkdownEditor
44status : Draft
55description : Full-featured Markdown input.
6- source : https://github.com/primer/react/tree/main/src/MarkdownEditor
76storybook : ' /react/storybook?path=/story/forms-markdowneditor--default'
87---
98
9+ ``` js
10+ import {MarkdownEditor } from ' @primer/react/drafts'
11+ ```
12+
1013` MarkdownEditor ` is a full-featured editor for GitHub Flavored Markdown, with support for:
1114
1215- Formatting (keyboard shortcuts & toolbar buttons)
@@ -23,8 +26,8 @@ storybook: '/react/storybook?path=/story/forms-markdowneditor--default'
2326
2427A ` Label ` is always required for accessibility:
2528
26- ``` javascript live noinline
27- const renderMarkdown = async (markdown : string ) => {
29+ ``` javascript live noinline drafts
30+ const renderMarkdown = async (markdown ) => {
2831 // In production code, this would make a query to some external API endpoint to render
2932 return " Rendered Markdown."
3033}
@@ -48,15 +51,15 @@ render(MinimalExample)
4851
4952### Suggestions, File Uploads, and Saved Replies
5053
51- ``` javascript live noinline
52- const renderMarkdown = async (markdown : string ) => " Rendered Markdown."
54+ ``` javascript live noinline drafts
55+ const renderMarkdown = async (markdown ) => " Rendered Markdown."
5356
54- const uploadFile = async (file: File ) : FileUploadResult => ({
57+ const uploadFile = async (file ) => ({
5558 url: ` https://example.com/${ encodeURIComponent (file .name )} ` ,
5659 file
5760})
5861
59- const emojis: Emoji [] = [
62+ const emojis = [
6063 {name: ' +1' , character: ' 👍' },
6164 {name: ' -1' , character: ' 👎' },
6265 {name: ' heart' , character: ' ❤️' },
@@ -74,7 +77,7 @@ const emojis: Emoji[] = [
7477 {name: ' thumbsdown' , character: ' 👎' }
7578]
7679
77- const references: Reference [] = [
80+ const references = [
7881 {id: ' 1' , titleText: ' Add logging functionality' , titleHtml: ' Add logging functionality' },
7982 {
8083 id: ' 2' ,
@@ -84,13 +87,13 @@ const references: Reference[] = [
8487 {id: ' 3' , titleText: ' Add error-handling functionality' , titleHtml: ' Add error-handling functionality' }
8588]
8689
87- const mentionables: Mentionable [] = [
90+ const mentionables = [
8891 {identifier: ' monalisa' , description: ' Monalisa Octocat' },
8992 {identifier: ' github' , description: ' GitHub' },
9093 {identifier: ' primer' , description: ' Primer' }
9194]
9295
93- const savedReplies: SavedReply [] = [
96+ const savedReplies = [
9497 {name: ' Duplicate' , content: ' Duplicate of #' },
9598 {name: ' Welcome' , content: ' Welcome to the project!\n\n Please be sure to read the contributor guidelines.' },
9699 {name: ' Thanks' , content: ' Thanks for your contribution!' }
@@ -123,8 +126,8 @@ render(MinimalExample)
123126
124127### Custom Buttons
125128
126- ``` javascript live noinline
127- const renderMarkdown = async (markdown : string ) => " Rendered Markdown."
129+ ``` javascript live noinline drafts
130+ const renderMarkdown = async (markdown ) => " Rendered Markdown."
128131
129132const MinimalExample = () => {
130133 const [value , setValue ] = React .useState (' ' )
0 commit comments