| 25 | * proxying the ref is necessary. Next.js dynamically imported components don't support refs. |
| 26 | */ |
| 27 | const Editor: FC<EditorProps> = ({ |
| 28 | onValueChange, |
| 29 | className, |
| 30 | contentEditableClassName, |
| 31 | ...props |
| 32 | }: EditorProps) => { |
| 33 | return ( |
| 34 | <MDXEditor |
| 35 | onChange={onValueChange} |
| 36 | className={className} |
| 37 | contentEditableClassName={cn( |
| 38 | "prose prose-stone !p-0", |
| 39 | contentEditableClassName, |
| 40 | )} |
| 41 | {...props} |
| 42 | plugins={[ |
| 43 | headingsPlugin({}), |
| 44 | listsPlugin(), |
| 45 | tablePlugin(), |
| 46 | codeBlockPlugin({ |
| 47 | defaultCodeBlockLanguage: "js", |
| 48 | }), |
| 49 | codeMirrorPlugin({ |
| 50 | codeBlockLanguages: { |
| 51 | js: "JavaScript", |
| 52 | css: "CSS", |
| 53 | ts: "TypeScript", |
| 54 | html: "HTML", |
| 55 | python: "Python", |
| 56 | bash: "Bash", |
| 57 | json: "JSON", |
| 58 | yaml: "YAML", |
| 59 | markdown: "Markdown", |
| 60 | sql: "SQL", |
| 61 | xml: "XML", |
| 62 | }, |
| 63 | }), |
| 64 | markdownShortcutPlugin(), |
| 65 | ]} |
| 66 | /> |
| 67 | ); |
| 68 | }; |
| 69 | |
| 70 | export default Editor; |