-
Notifications
You must be signed in to change notification settings - Fork 9
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
Showing
3 changed files
with
244 additions
and
262 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 |
---|---|---|
@@ -1,19 +1,26 @@ | ||
'use client' | ||
"use client"; | ||
|
||
import { MDXEditor, MDXEditorMethods, headingsPlugin } from "@mdxeditor/editor" | ||
import {FC} from 'react' | ||
import { MDXEditor, MDXEditorMethods, headingsPlugin } from "@mdxeditor/editor"; | ||
import { FC } from "react"; | ||
|
||
interface EditorProps { | ||
markdown: string | ||
editorRef?: React.MutableRefObject<MDXEditorMethods | null> | ||
markdown: string; | ||
editorRef?: React.MutableRefObject<MDXEditorMethods | null>; | ||
} | ||
|
||
/** | ||
* Extend this Component further with the necessary plugins or props you need. | ||
* proxying the ref is necessary. Next.js dynamically imported components don't support refs. | ||
*/ | ||
* proxying the ref is necessary. Next.js dynamically imported components don't support refs. | ||
*/ | ||
const Editor: FC<EditorProps> = ({ markdown, editorRef }) => { | ||
return <MDXEditor ref={editorRef} markdown={markdown} plugins={[headingsPlugin()]} /> | ||
} | ||
return ( | ||
<MDXEditor | ||
onChange={(e) => console.log(e)} | ||
ref={editorRef} | ||
markdown={markdown} | ||
plugins={[headingsPlugin()]} | ||
/> | ||
); | ||
}; | ||
|
||
export default Editor | ||
export default Editor; |
Oops, something went wrong.