tiptap/packages/html/src/getHTMLFromFragment.ts
2020-11-10 16:29:31 +01:00

14 lines
372 B
TypeScript

import { Node, DOMSerializer, Schema } from 'prosemirror-model'
// @ts-ignore
import { createHTMLDocument } from 'hostic-dom'
export default function getHTMLFromFragment(doc: Node, schema: Schema): string {
return DOMSerializer
.fromSchema(schema)
.serializeFragment(doc.content, {
document: createHTMLDocument(),
})
// @ts-ignore
.render()
}