mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-04 17:07:50 +08:00
8c6751f0c6
* chore: add precommit hook for eslint fixes, fix linting issues * chore: add eslint import sort plugin
13 lines
397 B
TypeScript
13 lines
397 B
TypeScript
import { DOMSerializer, Node, Schema } from 'prosemirror-model'
|
|
import { createHTMLDocument, VHTMLDocument } from 'zeed-dom'
|
|
|
|
export function getHTMLFromFragment(doc: Node, schema: Schema): string {
|
|
const document = DOMSerializer
|
|
.fromSchema(schema)
|
|
.serializeFragment(doc.content, {
|
|
document: createHTMLDocument(),
|
|
}) as unknown as VHTMLDocument
|
|
|
|
return document.render()
|
|
}
|