tiptap/packages/core/src/utils/generateHTML.ts

12 lines
397 B
TypeScript
Raw Normal View History

2020-09-24 06:29:05 +08:00
import { Node } from 'prosemirror-model'
import getSchema from './getSchema'
2020-10-29 00:20:38 +08:00
import getHTMLFromFragment from './getHTMLFromFragment'
2020-09-04 17:59:09 +08:00
import { Extensions } from '../types'
2020-10-29 00:20:38 +08:00
export default function generateHTML(doc: object, extensions: Extensions): string {
const schema = getSchema(extensions)
const contentNode = Node.fromJSON(schema, doc)
2020-10-29 00:20:38 +08:00
return getHTMLFromFragment(contentNode, schema)
}