2022-04-04 11:22:00 +05:30
|
|
|
import { MarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
|
2019-03-02 22:35:43 +05:30
|
|
|
import editorExtensions from './editor_extensions';
|
|
|
|
|
|
|
|
const nodes = editorExtensions
|
2021-03-08 18:12:59 +05:30
|
|
|
.filter((extension) => extension.type === 'node')
|
2019-03-02 22:35:43 +05:30
|
|
|
.reduce(
|
|
|
|
(ns, { name, toMarkdown }) => ({
|
|
|
|
...ns,
|
|
|
|
[name]: toMarkdown,
|
|
|
|
}),
|
|
|
|
{},
|
|
|
|
);
|
|
|
|
|
|
|
|
const marks = editorExtensions
|
2021-03-08 18:12:59 +05:30
|
|
|
.filter((extension) => extension.type === 'mark')
|
2019-03-02 22:35:43 +05:30
|
|
|
.reduce(
|
|
|
|
(ms, { name, toMarkdown }) => ({
|
|
|
|
...ms,
|
|
|
|
[name]: toMarkdown,
|
|
|
|
}),
|
|
|
|
{},
|
|
|
|
);
|
|
|
|
|
|
|
|
export default new MarkdownSerializer(nodes, marks);
|