Support for thematic breaks

- Use the '-' character
This commit is contained in:
Oliver Walters 2024-08-24 04:49:54 +00:00
parent ebb01c5e5b
commit b71df1e46f

View File

@ -10,6 +10,7 @@ import {
InsertAdmonition, InsertAdmonition,
InsertImage, InsertImage,
InsertTable, InsertTable,
InsertThematicBreak,
ListsToggle, ListsToggle,
MDXEditor, MDXEditor,
type MDXEditorMethods, type MDXEditorMethods,
@ -24,6 +25,7 @@ import {
markdownShortcutPlugin, markdownShortcutPlugin,
quotePlugin, quotePlugin,
tablePlugin, tablePlugin,
thematicBreakPlugin,
toolbarPlugin toolbarPlugin
} from '@mdxeditor/editor'; } from '@mdxeditor/editor';
import '@mdxeditor/editor/style.css'; import '@mdxeditor/editor/style.css';
@ -186,7 +188,8 @@ export default function NotesEditor({
listsPlugin(), listsPlugin(),
markdownShortcutPlugin(), markdownShortcutPlugin(),
quotePlugin(), quotePlugin(),
tablePlugin() tablePlugin(),
thematicBreakPlugin()
]; ];
let toolbar: ReactNode[] = []; let toolbar: ReactNode[] = [];
@ -225,7 +228,8 @@ export default function NotesEditor({
<Separator key="separator-4" />, <Separator key="separator-4" />,
<CreateLink key="create-link" />, <CreateLink key="create-link" />,
<InsertTable key="insert-table" />, <InsertTable key="insert-table" />,
<InsertAdmonition key="insert-admonition" /> <InsertAdmonition key="insert-admonition" />,
<InsertThematicBreak key="insert-thematic-break" />
]; ];
} }
} }
@ -255,6 +259,14 @@ export default function NotesEditor({
]); ]);
return ( return (
<MDXEditor ref={ref} markdown={''} readOnly={!editable} plugins={plugins} /> <MDXEditor
ref={ref}
markdown={''}
readOnly={!editable}
plugins={plugins}
toMarkdownOptions={{
rule: '-' // Use dashes for thematic breaks
}}
/>
); );
} }