-
Notifications
You must be signed in to change notification settings - Fork 0
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
13 changed files
with
6,590 additions
and
2,982 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,3 +1,6 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
"extends": ["eslint:recommended", "prettier", "next/core-web-vitals"], | ||
"globals": { | ||
"React": true | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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,19 @@ | ||
"use client"; | ||
|
||
import dynamic from "next/dynamic"; | ||
import { forwardRef } from "react"; | ||
import { type MDXEditorMethods, type MDXEditorProps } from "@mdxeditor/editor"; | ||
|
||
const Editor = dynamic(() => import("./InitializedMDXEditor"), { | ||
// Make sure we turn SSR off | ||
ssr: false, | ||
loading: () => <p>Loading...</p>, | ||
}); | ||
|
||
// This is what is imported by other components. Pre-initialized with plugins, and ready | ||
// to accept other props, including a ref. | ||
export const ForwardRefEditor = forwardRef<MDXEditorMethods, MDXEditorProps>( | ||
(props, ref) => <Editor {...props} editorRef={ref} /> | ||
); | ||
|
||
ForwardRefEditor.displayName = "ForwardRefEditor"; |
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,56 @@ | ||
"use client"; | ||
import type { ForwardedRef } from "react"; | ||
import { | ||
headingsPlugin, | ||
listsPlugin, | ||
quotePlugin, | ||
thematicBreakPlugin, | ||
markdownShortcutPlugin, | ||
toolbarPlugin, | ||
MDXEditor, | ||
UndoRedo, | ||
CodeToggle, | ||
CreateLink, | ||
ListsToggle, | ||
InsertCodeBlock, | ||
InsertImage, | ||
BoldItalicUnderlineToggles, | ||
InsertTable, | ||
type MDXEditorMethods, | ||
type MDXEditorProps, | ||
} from "@mdxeditor/editor"; | ||
import "@mdxeditor/editor/style.css"; | ||
|
||
export default function InitializedMDXEditor({ | ||
editorRef, | ||
...props | ||
}: { editorRef: ForwardedRef<MDXEditorMethods> | null } & MDXEditorProps) { | ||
return ( | ||
<MDXEditor | ||
contentEditableClassName="prose" | ||
plugins={[ | ||
headingsPlugin(), | ||
listsPlugin(), | ||
quotePlugin(), | ||
thematicBreakPlugin(), | ||
markdownShortcutPlugin(), | ||
toolbarPlugin({ | ||
toolbarContents: () => ( | ||
<> | ||
<UndoRedo /> | ||
<BoldItalicUnderlineToggles /> | ||
<CodeToggle /> | ||
<InsertCodeBlock /> | ||
<CreateLink /> | ||
<ListsToggle /> | ||
<InsertTable /> | ||
<InsertImage /> | ||
</> | ||
), | ||
}), | ||
]} | ||
{...props} | ||
ref={editorRef} | ||
/> | ||
); | ||
} |
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 @@ | ||
export { ForwardRefEditor as MDXEditor } from "./ForwardRefEditor"; |
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,13 @@ | ||
import type { Metadata } from "next"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Create new blog post", | ||
}; | ||
|
||
interface NewPostLayoutProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export default function NewPostLayout({ children }: NewPostLayoutProps) { | ||
return <main>{children}</main>; | ||
} |
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,3 @@ | ||
export default function NewPostPage() { | ||
return <div className="">create new blog post</div>; | ||
} |
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