Skip to content

Commit 241a482

Browse files
committed
update to version 2
1 parent 1e0b0ee commit 241a482

File tree

1 file changed

+12
-12
lines changed
  • packages/fields-document/src/DocumentEditor/pasting

1 file changed

+12
-12
lines changed

packages/fields-document/src/DocumentEditor/pasting/markdown.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import mdASTUtilFromMarkdown from 'mdast-util-from-markdown'
2-
// @ts-expect-error
3-
import autoLinkLiteralFromMarkdownExtension from 'mdast-util-gfm-autolink-literal/from-markdown'
4-
// @ts-expect-error
5-
import autoLinkLiteralMarkdownSyntax from 'micromark-extension-gfm-autolink-literal'
6-
// @ts-expect-error
7-
import gfmStrikethroughFromMarkdownExtension from 'mdast-util-gfm-strikethrough/from-markdown'
8-
import gfmStrikethroughMarkdownSyntax from 'micromark-extension-gfm-strikethrough'
1+
import { fromMarkdown } from 'mdast-util-from-markdown'
2+
3+
import { gfmAutolinkLiteralFromMarkdown } from 'mdast-util-gfm-autolink-literal'
4+
import { gfmAutolinkLiteral } from 'micromark-extension-gfm-autolink-literal'
5+
6+
import { gfmStrikethroughFromMarkdown } from 'mdast-util-gfm-strikethrough'
7+
import { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough'
8+
99
import { type Block } from '../editor-shared'
1010
import {
1111
type InlineFromExternalPaste,
@@ -15,20 +15,20 @@ import {
1515
} from './utils'
1616

1717
const markdownConfig = {
18-
mdastExtensions: [autoLinkLiteralFromMarkdownExtension, gfmStrikethroughFromMarkdownExtension],
19-
extensions: [autoLinkLiteralMarkdownSyntax, gfmStrikethroughMarkdownSyntax()],
18+
mdastExtensions: [gfmStrikethroughFromMarkdown(), gfmAutolinkLiteralFromMarkdown()],
19+
extensions: [gfmAutolinkLiteral(), gfmStrikethrough()],
2020
}
2121

2222
export function deserializeMarkdown (markdown: string) {
23-
const root = mdASTUtilFromMarkdown(markdown, markdownConfig)
23+
const root = fromMarkdown(markdown, markdownConfig)
2424
let nodes = root.children
2525
if (nodes.length === 1 && nodes[0].type === 'paragraph') {
2626
nodes = nodes[0].children
2727
}
2828
return deserializeChildren(nodes, markdown)
2929
}
3030

31-
type MDNode = ReturnType<typeof mdASTUtilFromMarkdown>['children'][number]
31+
type MDNode = ReturnType<typeof fromMarkdown>['children'][number]
3232

3333
function deserializeChildren (nodes: MDNode[], input: string) {
3434
const outputNodes: (InlineFromExternalPaste | Block)[] = []

0 commit comments

Comments
 (0)