tiptap/packages/html/getHTMLFromFragment.ts
2020-10-28 17:20:38 +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()
}