Skip to content

Commit

Permalink
Update to latest next
Browse files Browse the repository at this point in the history
  • Loading branch information
petyosi committed Apr 15, 2024
1 parent 314ad6a commit f5d2c7f
Show file tree
Hide file tree
Showing 3 changed files with 244 additions and 262 deletions.
27 changes: 17 additions & 10 deletions app/EditorComponent.tsx
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;
Loading

0 comments on commit f5d2c7f

Please sign in to comment.