tiptap/packages/html/getHtmlFromFragment.ts
2020-10-28 17:12:25 +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()
}